Can you bind() and connect() both ends of a UDP connection

后端 未结 10 1544
悲&欢浪女
悲&欢浪女 2020-12-01 04:40

I\'m writing a point-to-point message queue system, and it has to be able to operate over UDP. I could arbitrarily pick one side or the other to be the \"server\" but it do

10条回答
  •  有刺的猬
    2020-12-01 05:07

    This page contains some great info about connected versus unconnected sockets: http://www.masterraghu.com/subjects/np/introduction/unix_network_programming_v1.3/ch08lev1sec11.html

    This quote answers your question:

    Normally, it is a UDP client that calls connect, but there are applications in which the UDP server communicates with a single client for a long duration (e.g., TFTP); in this case, both the client and server can call connect.

提交回复
热议问题