Hi, new to PB, but not programming in general. I'm tinkering around with creating a threaded network server. Doesn't do anything yet but acknowledge when it gets a connection.
The problem I'm having is that it doesn't acknowledge network disconnects. It never receives the #PB_Network_Disconnect event. From what I've read, PB does not get this event unless another PB program closes the connection. But what about programs not written in PB? And what about if the network just drops the connection? How do I know when that happens? Although I am an experienced programmer, haven't done a lot with networking.
I'm running PB on a OS X Sierra, 10.12.6, but am not using any platform specific code.
Thanks!
Phil
network disconnects?
Re: network disconnects?
In PB, the client does not notice if the server connection is broken. The server, on the other hand, notices when a client says goodbye.
That's why we do this with "Pings". This means that a ping is sent at regular intervals, which must be returned, otherwise the server or client closes the connection.
That's why we do this with "Pings". This means that a ping is sent at regular intervals, which must be returned, otherwise the server or client closes the connection.
Re: network disconnects?
I run the network example and connect to it using a UNIX utility called netcat. Server acknowledges the connection. But when I kill netcat, the server does not get a disconnect message. So, I assume I have to do a ping like suggested or some kind of timeout value... don't hear from the client for X amount of time, kill the connection/thread.