Hi,
I'm curious about the behaviour of those network functions when the connection parameter is not valid anymore.
I'm working on a TCP client/server (=~ 250 simultaneous connected clients) and if a client disconnects when a working thread try to send data to it, crash happens. I have to check everytime the accessibility of the socket with a non PB native function.
If I compare with the win32 send_() function, this last one doesn't crash if the socket handle is obsolete.
Is there a technical reason why those functions crash with a "invalid memory access" ?
Could you enhance those functions so that they will accept an obsolete socket handle and return an new error value ?
Thanks for your time.
Send/ReceiveNetworkData(), ConnectionID()... crash prevention
Send/ReceiveNetworkData(), ConnectionID()... crash prevention
Last edited by tatanas on Mon Mar 31, 2025 11:43 am, edited 1 time in total.
Windows 10 Pro x64
PureBasic 6.20 x64
PureBasic 6.20 x64
Re: Send/ReceiveNetworkData(), ConnectionID()... crash prevention
+100tatanas wrote: Fri Mar 28, 2025 4:24 pm Could you enhance those function so that they will accept an obsolete socket handle and return an new error value ?
Re: Send/ReceiveNetworkData(), ConnectionID()... crash prevention
I use the TCP sockets a lot and returning an error message rather than crashing would be much better and allow you to handle the situation cleanly. The alternative would be something like IsConnection() so that it could be used like Isdatabase() to determine if the connection is valid.
Simon
Simon
Simon White
dCipher Computing
dCipher Computing