This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

netError when using netUDP_Send, even though reception works in same socket

Hello everyone!

I'm currently using Keil uVision 5 in order to program an UDP interface in order to communicate with another machine on my local network.

While the reception of messages via the configured UDP Socket work, the sending of messages does not appear to work, as I recieve a "netError" value on the netStatus value that the netUDP_Send() function returns. Based on the reference, this error simply states that the sending failed. I was not able to find any explanation as to why I am getting this error. Do you have any ideas or suggestions?

Here is a sample of the code I use to recieve and send the UDP messages (I am trying to send form the local 10000 UDP Port, to my computer's 61345 UDP port, whose IP adress is 192.168.1.72 :

NET_ADDR addr = { NET_ADDR_IP4, 61345, 192, 168, 1, 72};

int8_t start(void){
	
	int32_t socket = netUDP_GetSocket(udp_receive_callback);
	if(socket >= 0){ //Le socket est bien alloué
		if(netUDP_Open(socket,10000) == netOK){
		
			uint8_t *sendbuf;
			
			sendbuf = netUDP_GetBuffer(1);
			sendbuf[0]=0x65;
			netStatus status = netUDP_Send(socket,&addr,sendbuf,1);
			if(status == netOK)
				return 1;
			else{
				return -1;
			}
		}
		else
			return -1;
	}
	return -1;
}