Other Parts Discussed in Thread: C2000WARE
Hi,
I am creating a TCP driver based on lwIP 2.1.2 shipped in C2000Ware 2.00.00.02. I am able to succesfully create a TCP Server on the target and connect it to a TCP Client running on my PC using Hercules utility.
However, I am unable to create a connection when the target is configured as a TCP Client and I run a TCP Server on Hercules.
I logged the messages over Ethernet connetion in Wireshark and saw that the target initially sends a SYN command correctly.
In response the server running on my PC, sends a SYN+ACK command but that is not acknowledged by the client and hence the three-way handshake is not completed.
Following is my setup when the target is in Client mode:
pcb = tcp_new(); err = tcp_bind(pcb, IP_ADDR_ANY, LocalIPPort); GetIPAddressOctets(RemoteIPAddress,IPOctets);//Get the Remote IP Address Octets IP4_ADDR(&ipaddr_send, IPOctets[0], IPOctets[1], IPOctets[2], IPOctets[3]);//Create IP Address from Octets // listen for connections ret_val = tcp_connect(pcb, &ipaddr_send, ServerPort, client_connected); //server port for incoming connection if(ret_val !=ERR_OK) { // Assign a NULL pointer as error in building connection pcb = NULL; }
As I said before, the target sends the initial SYN command correctly through "tcp_connect" and so the "ret_val" in the above code is ERR_OK.
I am attaching the screenshots from Hercules and WireShark.
Any help as to why this is happening would be really helpful.
Thanks,
Manan