How to bind to any available port?

前端 未结 3 1887
旧时难觅i
旧时难觅i 2020-12-02 09:30

I need an app that sends an UDP packet to some network server and receives the response. The server replies to the same port number where request came from, so I first need

3条回答
  •  情歌与酒
    2020-12-02 09:36

    Call sendto without calling bind first, the socket will be bound automatically (to a free port).

提交回复
热议问题