fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
218 stars 135 forks source link

Check connected client(s) #97

Closed microup closed 3 years ago

microup commented 3 years ago

Hi,

Please, if you could give a simple sample - to check to connect a client(s))? (need to check every 30 sec, if a client doesn't send any data - his need disconnect)

Thanks!

microup commented 3 years ago

client object seems to be a net.Conn, choose a way to call client.SetReadDeadline() with the appropriate time.Time value before blocking on client.Read() :

c.client.SetDeadline( time.Now().Add(10 * time.Second )
pb, err := c.Read() { ...