Sign in to follow this  
Followers 0
Hest

TCPstartup and close question

4 posts in this topic

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!

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Hest

Software:Model Train Calculator (Screen)Autoit3 beginner!

Share this post


Link to post
Share on other sites

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.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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