开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜