go - Golang how do I simulate users idling on a webpage? -
hi guys wondering how might simulate users idling webpage
i'm making part of website show how many concurrent connections there server right don't have access more 1 computer.
it works , shows 1 person online, want write small little go program can set variable say, 100 people, , launch it, stay running , see if site correctly shows 100 people connected it.
i had like
package main
import ( "net" )
func main() { go connecttoserver() go connecttoserver() go connecttoserver() } func connecttoserver() { servaddr := "http://localhost:1337" tcpaddr, err := net.resolvetcpaddr("tcp", servaddr) if err != nil { panic(err) } _, err = net.dialtcp("tcp", nil, tcpaddr) if err != nil { panic(err) } }
it runs don't know if right way it, since they're go routines , ending instantly program starts stops right away need way keep connections alive without program stopping right away, information great. thanks!
Comments
Post a Comment