WIZnet Developer Forum

TCP Server Socket Problem

Hi All,
I am using a ITEAD iBoard Pro board for testing the W5100 chip in TCP Server mode.
If I use socket 0 or 2 everything seems to work fine but if I use socket 1 or 3 after going into listen mode I do not get a SOCK_ESTABLISHED (0x17) status after connecting with my client application like I do if I use socket 0 or 2, I get a status of SOCK_SYNRECV (0x16) constantly. I take it that this status is an intermediate state and should change to SOCK_ESTABLISHED after the connection is complete. Any ideas?

Jimbo

Hello,

In the same environment, using a different socket is no different.
Make sure that there are no differences in port settings or socket register settings.

Becky

hello, Jimbo

Seems you want to use 4 sockets all as TCP server. doesn’t it?

When you open 4 sockets as TCP Server, All socket has same source MAC and IP.

But only different is PORT number.

You must set different PORT number with each Socket. (refer Sn_PORTR)

With different PORT number, the client can connect to right Socket.

Thank you

lawrence

Hi Lawrence,
I tried changing the port number for each socket with the same result.
I setup the socket, sent the listen, I get a status of 0x14. Then try and connect from my client app and get a 0x16 status returned and it does not progress onto 0x17. Even if I only open socket 1 without opening socket 0 I get the same result.

Thanks for your help.

Jimbo

hi Jimbo

If the socket states goes to 0x16, it means socket received [SYN] packet from client and sending [SYN ACK] to client.

But if the state does not changed to 0x17, I think client can not receive [SYN ACK].

If client can not receive [SYN ACK], must check the network condition.

So, could you let me know the network cofiguratino? how you connect between app and w5100.

What if try to send [SYN] from PC that connected directly to w5100, if PC has successful connection, it means everything is ok but network has some problem.

But even the pc has fail, it means the firmware has some problem.

Thank you

lawrence

Let me suspect your code does not handle odd socket registers properly - e.g. your code is writing to registers of socket 0 when you think you access registers of socket 1. Perform the dump of socket 1 registers when you see it stuck in 0x16 state, and confirm all needed information (you wrote before and the one has to be there per connection process) is present and set properly.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.