Jump to content

How to check if TCP is connected


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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?

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...