[En-Nut-Discussion] Problem to send data with an UDP socket

Julien CHAUSSEC Julien.Chaussec at ifremer.fr
Tue Jul 5 11:39:40 CEST 2005


Hi everybody,

When i want to send data, with the function  NutUdpSendTo(), the 
returned data (rt) is -1. I use avr gcc. All the functions called before 
are OK. Sock gives the value 2934 and rc gives 0 the first and the 
second time.
There is enough memory availiable (NutHeapAvailable() ).

Here is the code i use:
int rc = NutRegisterDevice(&DEV_ETHER, 0x8300, 5);
u_long ip_addr = inet_addr(STDNET_IPADDR);
u_long ip_mask = inet_addr(STDNET_IPMASK);
rc = NutNetIfConfig("eth0", null_mac, ip_addr,ip_mask);

UDPSOCKET *sock;
sock = NutUdpCreateSocket(10999);
printf("nombre d'octets disponible=%d\n\r", mem);

char tab [50];
int rt;
for (;;)
	{
	rt = NutUdpSendTo(sock, inet_addr("134.246.255.255"), 
13020,tab,strlen(tab));
	NutSleep(1000);
     	}
}

Does anyone have an idea?
Thank you.

Julien.Chaussec at ifremer.fr




More information about the En-Nut-Discussion mailing list