Jump to content

Checking if Connection is Still up (TCP)


Mason
 Share

Recommended Posts

Is there a way to check if a connection still exists...say my AutoIt client crashes, and I want my server to drop the connection if it doesn't exist anymore...I couldn't see any useful functions for this but...I could be missing something.

Link to comment
Share on other sites

Yea...you try to receive data from it and if error is either 10054 or -1 then the connection is down...

so

while 1
$read=TCPRecv($socket,$buffer_length)
if @error=-1 OR @error=10054 then 
Msgbox(0,"","Socket is dead!")
ExitLoop
else
TrayTip("","Socket alive and well",10)
endif
wend
Edited by VicTT
Quote

Together we might liveDivided we must fall

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...