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 n开发者_开发问答ew 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.
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.
精彩评论