Jump to content
Sign in to follow this  
qwertylol

TCP server how to use

Recommended Posts

qwertylol

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 ?

Share this post


Link to post
Share on other sites
ChrisL

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

Share this post


Link to post
Share on other sites
qwertylol

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?

Share this post


Link to post
Share on other sites
ChrisL

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

Share this post


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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.