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

后端 未结 10 1612
悲&欢浪女
悲&欢浪女 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条回答
  •  -上瘾入骨i
    2020-12-01 05:03

    Really the key is connect():

    If the socket sockfd is of type SOCK_DGRAM then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received.

提交回复
热议问题