No server reply to client SYN TCP connection request
Hi,
I apologize if any of the following seem dumb but I'm relatively new to ethernet and TCP/IP embedded programming, even high-level programming at that.
I'm trying to establish a TCP 3-way handshake connection from NXP FRDM-K64 development board to a passive PC that has no application actual app running except WireShark and sometimes Internet Explorer, when I open the browser. NOTE that FRDM-K64 uses LWIP protocol stack, "around" TCP/IP stack. I send out SYN from the code. I see WireShark captures that the SYN packet was sent out - both src and dest IP addresses are correct. Also the port I put on the request is 80 (http).
The FRDM board normally comes up in original code as a "web server". That connection works fine. I recently (since last week) started coding the board as a client too by simply adding the calls to tcp connect.
Today, I added more TCP header "options" besides the MSS - windows scale = 2, shift by 2 or x4, and SACK permitted options. Why? because when I use this PC to GET website from FRDM webserver, that is the way it formats it's SYN TCP packet and the FRDM replies back with SYN-ACK... and the 3-way handshake started by PC client succeeds in establishing a TCP connection with PC as client and FRDM as server.
The additional TCP header options did not have any effect, still no SYN-ACK. I increased retries from 6 to 11 thinking the PC is just backed-up with connection requests and so it has not gotten to the FRDM's SYN packet. I only went up to 11 because pre-processor compiler complains about going >12 retransmissions (I didn't want to doctor the code any further). Wireshark shows the 1st SYN transmission from FRDM to PC and all the 11 retransmissions too.
Also NOTE: I don't really think this PC backed-up with many SYN requests, because it's ethernet cable is currently only directly hooked-up to the FRDM so there really would not be many requesting to TCP-connect with SYN to it except the board. None of these approaches solves the problem. FRDM's SYNs do not get ACKed.
I read somewhere maybe I should enable TIMESTAMP? in the option? while other readings said I should not so I have not done that.
QUESTIONS:
* Why is the PC not replying to the FRDM board with ACK?
* Do I need to have a server-app program running on the PC just to have the server endpoint respond to the SYN?
* Would simply opening a web browser suffice?
* What am I missing on the FRDN client side?
* What else should I do on the PC side that will be transparent to any other server - that any other server should or should not be doing to respond with an ACK to the FRDM board under their ethernet TCP/IP network protocol stack standard procedure to do 3-way handshake connection establishment?
Thanks for your help.
Something needs to be listening for the connection on the PC.
Here's an overview of the handshake: TCP Fundamentals Part 1 - Wireshark Talks at Sharkfest
If the PC can run WSL (Windows Subsystem for Linux) then you could use
nc
command as a listener.Or use the Windows version of ncat.
Once a listener is running, verify that the Windows firewall isn't blocking connections to it.
Chuckc, that makes sense. I'll look into this and let you know. Thanks.
I finally got to establish a 3-way handshake connection with FRDM-K64 as client initiating SYN packet and the PC as server ACK-ing back with SYN-ACK packet and FRDM reply with ACK. So connection state is ESTABLISHED.
After reading through some more suggestions on how to listen, I just ended-up using simple Windows cmd line "netstate -a". There I saw the target PC's IP address:port in "LISTENING" state. It so happen its IP:139. So I replaced port "80" (http) with "139" and voila! the PC port sent back an SYN-ACK and all things went well from there.
Now I have a connection to send out data to from the FRDM board.
I note that port 139 is a port for SMP protocol that enables inter-process communication. The server sent back RST-ACK in a few seconds because my FRDM board's program has not done any "upper-layer" data transfer ...(more)