Re: [go-nuts] Re: SetKeepAlive TCP server

2016-07-26 Thread djadala
you must also set keepalive period: SetKeepAlivePeriod( time.Minute) On Wednesday, July 27, 2016 at 7:19:24 AM UTC+3, EdgarAlejandro Vintimilla wrote: > > How can I let a conn alive, I have this code, the TCP server work but it > does not keep alive > > > func main() { > // Listen for inco

Re: [go-nuts] Re: SetKeepAlive TCP server

2016-07-26 Thread EdgarAlejandro Vintimilla
How can I let a conn alive, I have this code, the TCP server work but it does not keep alive func main() { // Listen for incoming connections. l, err := net.Listen(CONN_TYPE, CONN_HOST+":"+CONN_PORT) if err != nil { fmt.Println("Error listening:", err.Error()) os.Exi

Re: [go-nuts] Re: SetKeepAlive TCP server

2016-07-26 Thread Matt Harden
This is because your conn variable is probably of the type net.Conn (an interface) rather than *net.TCPConn, so the compiler doesn't know that the SetKeepAlive method is available. If you use a type assertion as djadala suggested: conn.(*net.TCPConn).SetKeepAlive then you are telling the compiler t

[go-nuts] Re: SetKeepAlive TCP server

2016-07-26 Thread djadala
tryconn.(*TCPConn ).SetKeepAlive On Tuesday, July 26, 2016 at 10:04:41 AM UTC+3, EdgarAlejandro Vintimilla wrote: > > > > > when I use the conn.SetKeepAlive i get this error: reference to undefined > field or method ‘SetKeepAlive’ > > https://golang.org/p