---
title: "Why does W5500 refuse connection?"
url: "https://maker.wiznet.io/forum/13239"
markdown_url: "https://maker.wiznet.io/forum/13239/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Mxyxixptlick"
created: "2019-03-12T06:30:33+09:00"
last_activity: "2023-01-06T07:32:41+09:00"
language: "en"
views: 1599
replies: 8
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# Why does W5500 refuse connection?

## Question

Asked by Mxyxixptlick on 2019-03-12 in Ethernet Chips.

While monitoring communication between Chrome browser and a W5500 I see a SYN packet from Chrome followed by an RST, ACK from the W5500 about 14 usecs later. I see two additional SYN packets from Chrome on the same source port, each about 0.5 secs apart and the W5500 replies to each with an RST, ACK about 10 usecs later. I don’t see any other SYNs during this time interval.

Based on log data surrounding (but not exactly at) this time, it appears that I have 3 available sockets, though I don’t have insight yet into what their status is. I suspect they were in a state that rendered them unavailable because I don’t see another SYN from Chrome get ACK’d until after a FIN, ACK sequence.

My question is: are there conditions other than lack of available sockets that will cause the W5500 to send a RST packet in response to a SYN?

## Replies

### Reply 1 by Eugeny, 2019-03-12

Mxyxixptlick:

> conditions other than lack of available sockets that will cause the W5500 to send a RST packet in response to a SYN?

Usually caused by no available sockets in listening state. I hit this issue with Chrome when designing web browser for W5100. Now I recommend using Firefox which has the setting to limit number of sockets it is going to use.

### Reply 2 by Mxyxixptlick, 2019-03-13 (in reply to reply 1)

I think my problem occurs due to the length of time between the W5500 ACKing a SYN packet on the socket on which it’s listening and the time the driver notices this and starts listening on another socket. The ideal solution would be to generate an interrupt when a new connection is made so an idle socket could be set to LISTEN immediately, but I don’t see any way to do that on a system based on an Arduino + shield connected via SPI.

Have you ever tried listening on the same port on multiple sockets? Seems like that would work if the W5500 just assigns incoming SYN packets to the first socket matching the requested port.

### Reply 3 by Eugeny, 2019-03-13

Mxyxixptlick:

> Have you ever tried listening on the same port on multiple sockets?

Of course! It is normal way to function. When SYN comes, W5x00 automatically selects next available socket listening on the port.

Mxyxixptlick:

> due to the length of time between the W5500 ACKing a SYN packet on the socket on which it’s listening and the time the driver notices this and starts listening on another socket.

Usually your goal is to serve request, disconnect, close and reopen for listening as fast as possible. I think it is possible to perform using interrupts, and server is going to “master” the connection deciding when connection is done.

### Reply 4 by irina, 2019-03-15

Mxyxixptlick:

> Have you ever tried listening on the same port on multiple sockets? Seems like that would work if the W5500 just assigns incoming SYN packets to the first socket matching the requested port.

Hi~
If you set on the same port on multiple socket, Socket numbers are connected in the order of lowest.
So, if you set the TCP Server on the same port about Socket 1 and Socket3, it will connect the Socket 1 and you will show the RST packet about socket 3.

thanks,
BR
irina

### Reply 5 by Mxyxixptlick, 2019-03-15

In your example, where the TCP server is listening on port 80 on Socket 1 and Socket 3 after Socket 1 connects would Socket 3 still be listening?

### Reply 6 by Mxyxixptlick, 2019-03-16

I tested this and found that the second socket does continue listening after the first connects. I also monitored network traffic with Wireshark and did NOT see RST packets from the other listening sockets.

### Reply 7 by Gasan Mugudinov, 2023-01-05 (in reply to reply 6)

Have you solved the problem? Can you share the solution?

### Reply 8 by Eugeny, 2023-01-06

Which problem do you have? As I see original poster’s problem was lack of listening sockets thus RST responses.

---

Source: https://maker.wiznet.io/forum/13239
