Chicko Bueno
Chicko Bueno

Reputation: 337

Listening UDP and monitoring

I have already created a UDP socket (UDP has been bound) and now i wanted the server to listen and if any client tries to connect, the listening UDP will then accept and pass the socket to a new thread to perform recvfrom and sento operation.

So how am I going to do that? How the client tells the server that he wanted to connect? May I use FD_CONNECT and FD_ACCEPT in UDP?

Thank you.

Upvotes: 3

Views: 919

Answers (1)

Heisenbug
Heisenbug

Reputation: 39164

UDP is a connectionless protocol. You don't need to connect an udp socket. Pay attention that use a connect on an UDP socket may have a different semantic respect what you are expecting: on linux for example a connect invoked on a UDP socket , "bind" that socket to a specific IP address, but this is only a local binding, nothing happens over the network.

Upvotes: 3

Related Questions