Jump to content

[Solved]TCP Multitasking


Recommended Posts

Is it possible to make 1 script receive information from 2 different sources via TCPRecv at the same time?

And if it is, how?

Or maybe I have to make a queue, like having the second computer wait until the first is completed?

At the moment I am using a Do loop on 1 TCPAccept token.

Do
   $KlientRecv1 = TCPRecv($TCPAccept, 2048)
  Until $KlientRecv1 <> ""
  GUICtrlSetData($Input1x, $KlientRecv1)
  _WriteToLog(GuiCtrlRead($Label1), $KlientRecv1)

Can post code if necessary.

Edited by Akarillon

Challenge accepted!

Link to comment
Share on other sites

TCPListen allows to specify a queue length for pending connections (and has a reasonable default value). So you can't handle two connections at the same time but one after the other. Give it a try.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

TCPListen allows to specify a queue length for pending connections (and has a resonable default value). So you can't handle two connections at the same time but one after the other. Give it a try.

Ye, that was my plan B :D

Plan C would be several executables.

Challenge accepted!

Link to comment
Share on other sites

Why do you want to process connections in parallel or run several executables? Do you have so many clients connecting at the same time? Or does processing the pakets take so much time that it would block other connections for too long?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Why do you want to process connections in parallel or run several executables? Do you have so many clients connecting at the same time? Or does processing the pakets take so much time that it would block other connections for too long?

I was planning on using this as an Inventory-software that receives information about computers every day at 6 o'clock exactly from over 400 computers..

Thought it would take forever to make a queue of them all

Challenge accepted!

Link to comment
Share on other sites

My understanding is that the queue is handled by the TCP stack itself. You listen on the socket, take the incoming data and process it. Then you receive the next paket, process it and so on. The pakets arriving during your processing of another clients data is queued by TCP.

If the queue overflows you raise the number in TCPListen.

Or you can extract the processing of the data into a separate AutoIt script, compile it and use Run to process the data. This way you can run multiple "processing" exe's in parallel. This depends on how your inventory system (database ...?) can handle parallel data input. If you need to send some feedback to the client when done it gets a bit more complex.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

My understanding is that the queue is handled by the TCP stack itself. You listen on the socket, take the incoming data and process it. Then you receive the next paket, process it and so on. The pakets arriving during your processing of another clients data is queued by TCP.

If the queue overflows you raise the number in TCPListen.

Or you can extract the processing of the data into a separate AutoIt script, compile it and use Run to process the data. This way you can run multiple "processing" exe's in parallel. This depends on how your inventory system (database ...?) can handle parallel data input. If you need to send some feedback to the client when done it gets a bit more complex.

I think I'll stay on the easy part of programming for the moment :D

Can the TCPListen handle incoming connections even if the script is occupied in a do-loop?

Challenge accepted!

Link to comment
Share on other sites

Yes, that's what the queue is for.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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