LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Use send() instead of sendto() for UDP (https://www.linuxquestions.org/questions/programming-9/use-send-instead-of-sendto-for-udp-783414/)

fjkum 01-20-2010 03:08 AM

Use send() instead of sendto() for UDP
 
Hi,

Can I use send() function to send UDP datagram through a socket instead of calling the sendTo()?

ForzaItalia2006 01-20-2010 06:14 AM

Hey,

it would help to check the man page for the send(2) system call.

"The send() call may be used only when the socket is in a connected state (so that the intended recipient is known)." As per definition, UDP is never in a connected state, so that you can't use send(2) instead of sendto(2).

- Andi -

fjkum 01-20-2010 10:16 PM

Ah okay, that explains why I still can use send(); that's because my implementation of UDP is a "connected" state by calling to connect() before send().

Thanks!


All times are GMT -5. The time now is 06:28 AM.