---
title: "TCP communication freezes after a while on W7500P"
url: "https://maker.wiznet.io/forum/12118"
markdown_url: "https://maker.wiznet.io/forum/12118/md"
type: "Forum topic"
category: "MCU & Boards"
author: "joaopaulob"
created: "2017-01-30T14:05:13+09:00"
last_activity: "2017-05-30T20:22:21+09:00"
language: "en"
views: 1170
replies: 4
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# TCP communication freezes after a while on W7500P

## Question

Asked by joaopaulob on 2017-01-30 in MCU & Boards.

Hi,

I established an TCP client-server communication with a WIZwiki-W7500P and PC, but the W7500P freezes after some time.

The WIZwiki is the client who connect on the server side (PC - Linux). The server sends 1000 bytes each 200 ms.
After transfer about 1 MB transferred the communication and the board freezes.

The client WIZwiki-W7500P code:

```
int main() {
    int phy_link;
    pc.printf("Wait a second...\r\n");
    uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x01, 0x02}; 
    
    EthernetInterface eth;
    eth.init(mac_addr); //Use DHCP
    eth.connect();
    
    do{
        phy_link = eth.ethernet_link();
        pc.printf("...");
        wait(2);
    }while(!phy_link);
        printf("\r\n");
     
    pc.printf("IP Address is %s\r\n", eth.getIPAddress());
    
    TCPSocketConnection sock;
    int ret = sock.connect("192.168.3.105", 8080);
 
    char buffer[1024];
    while (true) {
        ret = sock.receive(buffer, sizeof(buffer));          
        pc.printf("Received from server: %d\n\r", ret);
    }
 
    sock.close();
    
    eth.disconnect();
}
```

The server Linux:

`while(1){ n = write(childfd, buf, 1000); if (n < 0) error("ERROR writing to socket"); usleep(1000*200); }`

Any idea? Does the W7500P IOP implements congestion control?

Environment: mbed

Best regards

## Replies

### Reply 1 by lawrence, 2017-01-31

hello, joaopaulob

could you capture the packets through wireshark?

in tcp communication, it is easy way to check the packet flow.

[url][https://www.wireshark.org/download.html\[/url\]](https://www.wireshark.org/download.html%5B/url%5D)

if you do not know how to use wireshark, please ask any thing.

thank you

### Reply 2 by pherig, 2017-02-08

I have faced a similar issue and the error was happening because the MCU socket was closing due to a timeout. Wireshark should help a lot and if the problem is in the W7500P side, then I would suggest you to use a debug snippet like this one:

```
void debug_socketSN(uint8_t sn) {
		printf("WZTOE_Sn_RX_RSR: %d\r\n",(*(volatile uint32_t *)WZTOE_Sn_RX_RSR(sn)));
		printf("WZTOE_Sn_RXBUF_SIZE: %d\r\n",(*(volatile uint32_t *)WZTOE_Sn_RXBUF_SIZE(sn)));
		printf("WZTOE_Sn_RX_RD: %d\r\n",(*(volatile uint32_t *)WZTOE_Sn_RX_RD(sn)));
		printf("WZTOE_Sn_RX_WR: %d\r\n",(*(volatile uint32_t *)WZTOE_Sn_RX_WR(sn)));
		printf("WZTOE_Sn_SR: 0x%x\r\n",(*(volatile uint32_t *)WZTOE_Sn_SR(sn)));
}
```

hope this helps.

### Reply 3 by lawrence, 2017-05-29

Thank you, pherig

It is right.

These codes are helpful to know the tcp data flow.

### Reply 4 by joaopaulob, 2017-05-29 (in reply to reply 3)

Thank you very much

---

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