---
title: "sendto() never returns"
url: "https://maker.wiznet.io/forum/13987"
markdown_url: "https://maker.wiznet.io/forum/13987/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "fuchsc"
created: "2020-08-27T08:49:45+09:00"
last_activity: "2020-09-09T05:23:22+09:00"
language: "en"
views: 600
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# sendto() never returns

## Question

Asked by fuchsc on 2020-08-27 in Ethernet Chips.

Hi.
I’m using W5500 connected to a Windows 10 PC. The network card has an IP addresse 192.168.137.3 with Subnet 255.255.255.0.
W5500 has IP address 192.168.1.161, Subnet 255.255.255.0.

If I’m sending a broadcast from PC the W5500 shall send a respond, but doesn’t. In Debugger I can see that the sendto() function doesn’t return because no Sn_IR_SENDOK or Sn_IR_TIMEOUT bit gets set.

What can I do, to prevent endless looping in sendto() function?

Thanks
BR
Christian

## Replies

### Reply 1 by irina, 2020-09-09

I think I want to you refer to test the loopback test of this link.

[github.com](https://github.com/Wiznet/ioLibrary_Driver/blob/master/Application/loopback/loopback.c)

#### [Wiznet/ioLibrary_Driver/blob/master/Application/loopback/loopback.c](https://github.com/Wiznet/ioLibrary_Driver/blob/master/Application/loopback/loopback.c)

```
#include <stdio.h>
#include "loopback.h"
#include "socket.h"
#include "wizchip_conf.h"

#if LOOPBACK_MODE == LOOPBACK_MAIN_NOBLCOK

int32_t loopback_tcps(uint8_t sn, uint8_t* buf, uint16_t port)
{
   int32_t ret;
   uint16_t size = 0, sentsize=0;

#ifdef _LOOPBACK_DEBUG_
   uint8_t destip[4];
   uint16_t destport;
#endif

   switch(getSn_SR(sn))
   {
      case SOCK_ESTABLISHED :
```

This file has been truncated. [show original](https://github.com/Wiznet/ioLibrary_Driver/blob/master/Application/loopback/loopback.c)

Also if you use the sendto() function, you have to enable the Sn_IR.

### Reply 2 by fuchsc, 2020-09-09 (in reply to reply 1)

Hi.
Thanks for your response.
I’ve made two posts with the same question, because the first was blocked for a long time.
I’ve already found the problem for myself, see

![](https://avatars.discourse-cdn.com/v4/letter/f/bb73d2/48.png) [sendto() never returns](https://forum.wiznet.io/t/topic/7922) [W5500](https://maker.wiznet.io/c/tcp-ip-chip/w5500/18)

> Hi. I’ve connected a W5500 (IP address 192.168.1.161 Subnet 255.255.255.0) to a Windows 10 PC (IP address 192.168.137.3 Subnet 255.255.255.0) The PC is sending a broadcast and expecting an answer from W5500. But there is no answer packet, because the function sendto() never returns. In debugger I can see that Sn_IR_SENDOK or Sn_IR_TIMEOUT bits never get set. What can I do to prevent endless looping in sendto() function? Thanks BR Christian

BR
Christian

---

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