How to test if a socket is connected

  • Thread starter Thread starter Nuno Magalhaes
  • Start date Start date
N

Nuno Magalhaes

socket.Connected only gives the last access result but not the current
status of the socket.

What is the best way to determine if a socket is still connected?
Because I want to cancel all my "output" in the client if the socket is
not connected.

What is the best way to determine if a socket is still active on the
server side? When I close my server clients will still do their jobs
and I don't want that to happen.

Thanks for any reply,
Nuno Magalhaes.
 
You can always try to receive or send something, in 'try' block. No
matter what happend - .connected property is filled, right after.
Then only catch an exception and you are home.
PK
 
You can always try to receive or send something, in 'try' block. No
matter what will happen - .connected property will be filled, right after.
Then only catch an exception and you are home.
PK
 
Back
Top