---
title: "w6100 blocking"
url: "https://maker.wiznet.io/forum/13624"
markdown_url: "https://maker.wiznet.io/forum/13624/md"
type: "Forum topic"
category: "Ethernet Chips"
author: "Mario Runje"
created: "2019-12-31T12:29:47+09:00"
last_activity: "2020-01-04T13:00:34+09:00"
language: "en"
views: 889
replies: 3
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# w6100 blocking

## Question

Asked by Mario Runje on 2019-12-31 in Ethernet Chips.

Hi, i have created my own function for sending some buffer data over udp ipv4 by striping down loopback code. If i send data to lets say 192.168.137.1 and dont configure ethernet port on laptop to have that static ip whole EVB board is blocked when it enters in that send function. How can i avoid that blocking, so that it sends data to that IP no matter is that ip existing or not in network?

Code for that function:

```
void Client ( uint8_t ip[4],  uint16_t port, char *buffer, int lenght_send){
	uint8_t status;
	datasize_t received_size;
	datasize_t ret;
	uint16_t sentsize;
	uint8_t* mode_msg;
	uint8_t sn  = 1;
	uint8_t loopback_mode = AS_IPV4;



	if(loopback_mode == AS_IPV4)
	{
			mode_msg = msg_v4;
	}else if(loopback_mode == AS_IPV6)
	{
			mode_msg = msg_v6;
	}else
	{
			mode_msg = msg_dual;
	}

	getsockopt(sn, SO_STATUS,&status);
	switch(status)
	{
	case SOCK_UDP:
		received_size = (uint16_t) lenght_send;
		sentsize = 0;
		if(received_size>0)
		{
			while(sentsize != received_size){
				ret = sendto(sn, (uint8_t*)buffer+sentsize, received_size-sentsize, ip, port, 4);

				//if(ret < 0) return ret;

				sentsize += ret; // Don't care SOCKERR_BUSY, because it is zero.
			 }
		}

		break;
	case SOCK_CLOSED:

		switch(loopback_mode)
		{
		case AS_IPV4:
		   socket(sn,Sn_MR_UDP4, port, SOCK_IO_NONBLOCK);
		   break;
		case AS_IPV6:
		   socket(sn,Sn_MR_UDP6, port, SOCK_IO_NONBLOCK);
		   break;
		case AS_IPDUAL:
			socket(sn,Sn_MR_UDPD, port, SOCK_IO_NONBLOCK);
			break;
		}
		printf("%d:Opened, UDP loopback, port [%d] as %s\r\n", sn, port, mode_msg);

	}
}
```

## Replies

### Reply 1 by becky, 2020-01-02

Sorry, I am difficult to know your situation.
Could please let me know for detailed information.

### Reply 2 by Mario Runje, 2020-01-02

So, I have used loopback example to figure out how to send and receive packets over UDP.

I have created, based on that, my function Client that sends some buffer to specific IP and PORT.

My problem is that when IP that i want to send to isnt available (lets say im sending data to 192.168.1.13 and there is no client with that IP on network) my code stops when i call that function.

How should i code my application so that i can send data to that IP , although it doesnt exist in network, and my application wont stop ?

Pseudocode for what i have now:

I press button:
Send data from buffer to 192.168.1.13 port 7005 → it enters to the send function and
whole code stops reacting
Turn on LED

### Reply 3 by Mario Runje, 2020-01-04

Thanks, i tried something else and forgot to uncomment that…

---

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