Hest Posted September 9, 2009 Share Posted September 9, 2009 Hi all. I have a question about TCP stuff.. I'm making a program, that does some communications over TCP. I have the program running and working and every time I send a command, I use TCPstartup, send the command, listens for reply and then uses TCP shutdown. I send a command a couple of times each minute. My question is, is this the correct way to use TCP in autoit? Would it be better to just run TCPstartup in the beginning and let it run untill the program closes or should I only open and close TCP while in use. Whats the best or right way to do it? When I use TCPstartup every time I send a command, I also get a different outgoing port every time. Thats not really a problem, but I thought it might have some kind of effect at some point. TL;DR When should TCPstartup be run, at program start or start it up every time it's needed and then close again. Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
colafrysen Posted September 9, 2009 Share Posted September 9, 2009 You only need to call Startup and shutdown once, when TCP is started, you can do whatever you want until its shut down. So start it at program start (or when you start using the protocol) and shut it down when needed (preferably in the onautoitexit function) [font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size] Link to comment Share on other sites More sharing options...
Hest Posted September 9, 2009 Author Share Posted September 9, 2009 (edited) Cool, thx. Will try and rework my program and let TCP run. If I want to make a tcp send and a listen at the same time, any tips on how to do that best? Somehow TCPlisten should run on its own all the time while I can send data whenever I want. Edited September 9, 2009 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
dantay9 Posted September 9, 2009 Share Posted September 9, 2009 There are a few UDF's by Kip and a few others. I remember seeing something like asynchronious tcp functions around here. If that doesn't work out for you, it is easily overcome with two ports, one for listening and one for sending. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now