Unix sockets: when to use bind() function?

前端 未结 5 461
暖寄归人
暖寄归人 2021-02-04 12:21

I\'ve not a clear idea about when I have to use the bind() function. I guess it should be used whenever I need to receive data (i.e. recv() or recvfrom() functions) whether I\'m

5条回答
  •  爱一瞬间的悲伤
    2021-02-04 12:42

    You use bind whenever you want to bind to a local address. You mostly use this for opening a listening socket on a specific address/port, but it can also be used to fix the address/port of an outgoing TCP connection.

提交回复
热议问题