I'm developing a generic UDP server. After creating the socket (SOCK_DGRAM) I call bind and then I start looping with recvfrom function. Inside the loop I try to respond to the incoming peer with sendto function (after launching another thread that uses another socket to respond) but the peer doesn't recives anything.
I am testing it with a simple code UDP client that creates the socket, calls a sendto that reaches OK to the server, and then gets stuck in the recvfrom function.
What am I doing wrong? I think that the problem resides in making another socket for the server response :S
For the server side - after the bind, he should listen, once listen returns he should accept then use the socket from the accept to communicate to the client that connected.
If you are interested in doing tcp/ip internet stuff like this, a good guide is this one: http://beej.us/guide/bgnet/
Thanks for the replies but the protocol is UDP, not TCP... so the server doesn't need to use listen() because there is no connection between server and client in UDP. For the same reason accept() doesn't work.