skreien 0 Posted June 30, 2011 (edited) Hey everyone, I can't figure out a way to get the source TCP port of a connection. Here's the order of operations that I MUST follow due to interaction with another software: 1. Open connection (Source opens on a random high TCP port) 2. Send client name and class 3. Close socket so a FIN,ACK is generated 4. Open a listening socket on the same source port as the original socket 5. Receive information on connection The server only sends its information if the socket is closed so it sees a FIN, ACK TCP sequence. I tried using TCPRecv after TCPSend, but that sends a RST, not a FIN, so it won't work. So how can I get the TCP source port that my original socket was sending on? Thanks for any help. This one has me stuck. Edited June 30, 2011 by skreien Share this post Link to post Share on other sites
monoscout999 10 Posted July 1, 2011 (edited) I only can offer you this, because i don`t have any idea about that.A link to an UDF this will help you... and if i was you i will the search in other places like this MSDN Search there a lot of exaples in other languajes, and you have a lot of useful info. Edited July 1, 2011 by monoscout999 Share this post Link to post Share on other sites
skreien 0 Posted July 1, 2011 I'm not finding much of anything that (at the risk of sounding lazy) I can use without a whole lot of work. I really don't want to re-engineer a new tcpsend. I had thought about parsing the output from netstat to find the port number, but that seems awfully heavy and unreliable. Share this post Link to post Share on other sites
skreien 0 Posted July 1, 2011 (edited) Thanks for the info monoscout999. I found something else that gave me what I was looking for but I don't think it's going to help.I did find this link to that I tried, and it's giving me the correct port. However, the TCPReceive isn't working because the information that's coming back from the server really isn't on a new connection like what I'm expecting in AutoIt. Here's the sequence:SYNSYN ACKACKsend my client data nowFIN ACKACKserver sends data backFIN ACKAnyone know how I can match this cadence with AutoIt and receive the data? I've been playing with it for over a week, I still am stumped. Maybe it's not possible. Edited July 1, 2011 by skreien Share this post Link to post Share on other sites
skreien 0 Posted July 3, 2011 I'm going to try posting this in the developers forum. Since they deal with the source maybe they will have an idea. Share this post Link to post Share on other sites