Hest Posted July 25, 2008 Share Posted July 25, 2008 (edited) I have made a little piece of software, that sends a string to a train controller. The controller sends back a confirmation and here the problems are beginning. I have used a packet logger and found out, that my program sendts the string to the correct port, but the outgoing port from the PC is random. The response from the train controller goes back to that random port. Is it possible to choose what port should be used as outgoing, so that I can listen for a response on the correct port? I have added a picture as example. PC has ip x.x.x.2, train controller has x.x.x.3 and receives on port 15471 My program sends the string from port 51277 to 15471 and the controller sends back from 15471 to 51277, but because 51277 is random, my program don't know what port to listen on.. Any help is very appreciated Edited July 25, 2008 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
ProgAndy Posted July 25, 2008 Share Posted July 25, 2008 You don't need to know the port. the connection established by $Connection = TCPConnect(...,...) is bidirectional. To send, use TCPSend($Connection,...) And receive with $data = TCPRecv($Connection,2048) *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Hest Posted July 25, 2008 Author Share Posted July 25, 2008 (edited) Edit: Working now, I made a mistake. Sadly I don't remember exactly what it was. Edited July 25, 2008 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! 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