w6100 blocking

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);

	}
}

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

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

Dear!

Why you remove the code to check the send error status.

If destination ip is not exist, the chip will occure the timeout of send. this situation should be manged to error.

while(sentsize != received_size){
				ret = sendto(sn, (uint8_t*)buffer+sentsize, received_size-sentsize, ip, port, 4);

				if(ret < 0) return ret;   // it should be needed.

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

thank you.

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