开发者

how can i receive a specific client with recvfrom function

In a server by using udp socket, how can i receive data from a specific client? i know that how to use recvfrom a开发者_开发技巧nd sender address is also returned. but the problem is that recvfrom function receives data from any client. but i want for example, recvfrom receive data only for client2. (with address cliAddr2); How can i do this? (i am using c languange on linux)

Thanks for answers.


You can use connect() similar to TCP sockets to limit packets to one source.


AFAIK, you can not prevent recvfrom() from receiving data from any client, the only way is to drop the data in your program yourself or use netfilter/iptables for example.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜