Jump to content
Sign in to follow this  
mladost1

How to check if TCP is connected

Recommended Posts

mladost1

I made a script that connects my and my room8s pc (TCP) by i have a problem - I have to restart my program(host) every time he turns his computer on and runs the client script. Is there a way i can check that he is disconnected and turn on the listening port again. (Does my TCPAccept() change to -1?)

Edited by mladost1

Share this post


Link to post
Share on other sites
SmOke_N

I made a script that connects my and my room8s pc (TCP) by i have a problem - I have to restart my program(host) every time he turns his computer on and runs the server script. Is there a way i can check that he is disconnected and turn on the listening port again. (Does my TCPAccept() change to -1?)

If he's the client, why is he running a server script?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
mladost1

If he's the client, why is he running a server script?

Sorry about that, my mistake

However the question still exist:

$main=TCPConnect($server,$port)
Do
;do something
Until $main=-1

However the mainsocket never changes and if i do this the socket always refreshes and has no time to connect:

$main=TCPConnect($server,$port)
Do
$main=TCPConnect($server,$port)
;do something
Until $main=-1

What should I do?

Share this post


Link to post
Share on other sites
sandin

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
Sign in to follow this  

×