lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE : [lwip-users] recv callback function for sockets?


From: Frédéric BERNON
Subject: RE : [lwip-users] recv callback function for sockets?
Date: Tue, 28 Apr 2009 14:41:28 +0200

There is no such feature (at least, something really standard), since sockets 
API paradigm is not to use events, but more to use synchronous function calls. 
But you could use "select" or the SO_RCVTIMEO option to perform a receive with 
timeout to avoid to block your task. 

 
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : address@hidden 
Web Site : http://www.hymatom.fr 

Plan d'accès au siège social 

====================================
P Avant d'imprimer, penser à l'environnement


-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Mathias Zenger
Envoyé : mardi 28 avril 2009 13:49
À : address@hidden
Objet : [lwip-users] recv callback function for sockets?


Hi,

I am using lwIP in context with FreeRTOS and try to write a NTP client. I have 
a task which is called fix every 1000 ms. In the task loop I either send out a 
UDP request to a NTP server or poll recvfrom() for received UDP replies. For 
communication I am using the socket API.

My problem is that I should process the received packets immediately. Polling 
recvfrom() every second is too slow. I am wondering if it's possible to 
register a callback function which will be called as soon a packet was received 
-> similar to udp_recv(). How would I have to use it with sockets??

Thanks for helping! Best regards,
Mathias


Additional information:

- My socket is non-blocking: lwip_ioctl(fd, FIONBIO, &noblock_true);
- Sending out my request datagram works fine: sendto(fd, &snd_buffer, 
sizeof(snd_buffer), 0, (struct sockaddr *)&addr, addr_length);
- Reception basically works fine too: recvfrom(fd, &rec_buffer, 
sizeof(rec_buffer), 0, (struct sockaddr *)&addr, &addr_length);




_______________________________________________
lwip-users mailing list
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]