Currently, when a connection is closed on the other end, the Socket id is never set to 0. Therefore, the program can never tell whether the socket is still valid or not.
This is bad because when the server tries to close a client connection, it will always crash if the socket is no longer valid. And, currently, there is no way in PB to determine whether a socket is valid ...
It would be nice to have this command so that client connections can be safely closed on the server side without the server crashing.
isConnected(Socket)
-
- Enthusiast
- Posts: 196
- Joined: Tue Sep 30, 2003 4:32 pm
- Location: The Netherlands
Shanara,
In the manual (help file) see:
With that YOU (the server) can disconnect the client.
And the otherway when the client is disconnecting, you get an
see the manual under: again.
Hope this helps.
Jan V.
In the manual (help file) see:
Code: Select all
CloseNetworkConnection(Connection)
And the otherway when the client is disconnecting, you get an
Code: Select all
#PB_NetworkEvent_Disconnect
Code: Select all
CloseNetworkConnection(Connection)
Hope this helps.
Jan V.
Life goes to Fast, Enjoy!!
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
Basically..
A client could disconnect anytime they want. It is entirely possible for the server to try to send data right before the the client disconnect event is raised. This happens quite often. And when it does, the server crashes ... so ...
If there was a way to determine if a connection is valid, then we could always check if the connection is valid before any network command.
Right now, the only thing the server can do is crash because there is no way to check if a connection is valid or not.
A client could disconnect anytime they want. It is entirely possible for the server to try to send data right before the the client disconnect event is raised. This happens quite often. And when it does, the server crashes ... so ...
If there was a way to determine if a connection is valid, then we could always check if the connection is valid before any network command.
Right now, the only thing the server can do is crash because there is no way to check if a connection is valid or not.
-
- Enthusiast
- Posts: 196
- Joined: Tue Sep 30, 2003 4:32 pm
- Location: The Netherlands
So keep a linked list (or array) where every 'valid' client is on. If an "#PB_NetworkEvent_Disconnect" fires get the client of the list an do not send anymore aka test just before any send comand to the client.
Second you need a timeout parameter for every send command so not to lockup your server the term used by you as 'crash' is something else. i bet the server is still running but out of sync with the client.
I believe there is an 'timeout' parameter in the beta section for the network commands (there is a recent post about this i think in the bugs section of the forum).
Jan V.
Second you need a timeout parameter for every send command so not to lockup your server the term used by you as 'crash' is something else. i bet the server is still running but out of sync with the client.
I believe there is an 'timeout' parameter in the beta section for the network commands (there is a recent post about this i think in the bugs section of the forum).
Jan V.
Life goes to Fast, Enjoy!!
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)
PB 4 is to good to be true, wake up man it is NOT a dream THIS is a reality!!!
AMD Athlon on 1.75G, 1Gb ram, 160Gb HD, NVidia FX5200, NEC ND-3500AG DVD+RW and CD+RW, in a Qbic EO3702A and Win XP Pro SP2 (registered)