Sign in to follow this  
Followers 0
darkjohn20

TCP Multithreading or Individual Sending

2 posts in this topic

Recently I have been working on a program that contains x Clients that connect to a server. There is also another client that acts as a remote server.

The server is run as so:

If Client = Normal

;Normal stuff

If Client = Remote

;Stuff for the Remote server

I ran into a problem with this method though. Sometimes messages get mixed because of frequent sending.

I have a function on the server that sends a "*" every 100-1000ms to check if the client is still connected.

Sometimes while sending things the beginning or end of my message will be a *.

I also noticed that it takes a lot of time sending to multiple places.

My question is: Could I run the server on 2 ports, have the client connect to both ports, and send different messages on each port at the same time?

Port1 would send "*"

Port2 would handle all other client messaging

Port3 would handle sending to the remote server

Would this work, or would there need to be multithreading capability in AutoIt, or at least theTCP functions?

I realize rewriting all of AutoIt with multithreaded capability would be quite impossible. I have read posts pertaining to this topic that ended in nothing but "No".

Also, is making the remote server a client a good idea, or should i try:

Clients - TcpConnect

Server - TcpListen AND TcpConnect

Remote Server - TcpListen

Would having the server do both work? or can it only use one at a time?

Any information on the situation would be greatly appreciated, even if it is bad news. Thanks!

Share this post


Link to post
Share on other sites



In case the last part was hard to understand, should I do:

Server <- Clients on port 55555

Server <- Remote Server on port 55556

Or:

Remote Server <- Server on port 55555

Server <- Clients on port 55556

Also, I just made some example code for this and it seemed to work ok.

I am still unsure whether messaged will get mixed or not, and if they will go faster.

If I send on port 55555 and port 55556 at the same time, will one not be received (It wouldn't if they were the same server)

Could anyone share their knowledge?

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  
Followers 0