Jump to content

TCP server how to use


Recommended Posts

http://www.autoitscript.com/forum/index.ph...c=29882&hl=

http://www.autoitscript.com/forum/index.ph...c=20589&hl=

TCP Client Example:

I was given these two links for ready-made server/client combo.

what I don't understand is, it seems both uses

While 1

WEnd

to loop the send/recv of messages, how do I run the rest of the script to process the $data if the script uses an infinite loop for tcp functions alone ?

Link to comment
Share on other sites

http://www.autoitscript.com/forum/index.ph...c=29882&hl=

http://www.autoitscript.com/forum/index.ph...c=20589&hl=

TCP Client Example:

I was given these two links for ready-made server/client combo.

what I don't understand is, it seems both uses

While 1

WEnd

to loop the send/recv of messages, how do I run the rest of the script to process the $data if the script uses an infinite loop for tcp functions alone ?

The loop is to constantly poll for data ($data)

What you do when you receive data is up to you, you could call a function

If $data <> "" then MyFunc($data)

But you always come back to this loop to poll for more data

Link to comment
Share on other sites

Do you mean, while the loop is infinite, somehow the rest of the non-server/client related script can run?

What does it choose which line to run?

Yes the loop is infinite

If you didn't have a loop. you would start your server, it would check for data, chances are there wouldn't be any data so it would exit

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