 RE: RL-ARM udp_send() issue Radovan Burhan I am afraid there is nothing wrong with the socket initialisation. Socket recieves data but I have problem sending data out. The only instance when I manage to send out the data is when I first recieve them from PC and then reply to the same address. Otherwise all attempts to send out UDP packet end up in an error. My aim is to sned out an UDP packet with NTP request and wait for reply with time information. Below is the code part for socket initialisation and the function where data is sent out. init_TcpNet (); udp_soc = udp_get_socket (0, UDP_OPT_SEND_CS | UDP_OPT_CHK_CS, udp_callback); if (udp_soc != 0) { udp_open (udp_soc, 200); } This is followed by the timer_poll() and main_TcpNet() endless loop. Function to send data out: unsigned char udp_msg[] = {"\111\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; U8 remip[4] = {192,168,1,154}; U8* sendbuf; U16 len; if (mem_test (localm[NETIF_ETH].IpAdr, 0, 4) == __TRUE) { // IP address not yet assigned by DHCP. printf(" return "); return; } len = strlen(udp_msg); sendbuf = udp_get_buf(len); str_copy(sendbuf, udp_msg); printf(" Alokace %d %d %d",sendbuf, sendbuf[0], udp_msg[0]); answer = udp_send(udp_soc, remip, 200, sendbuf, len); |