C socket get IP address from filedescriptor returned from accept

后端 未结 3 853
独厮守ぢ
独厮守ぢ 2021-01-02 07:26

I know this question seems typical and multiple times answered but I think if you read the details it is not so common (I did not find it).

The poin

3条回答
  •  离开以前
    2021-01-02 08:32

    You would use getsockname() (http://linux.die.net/man/2/getsockname) to get the IP of the bound socket.

    Also answered before, here: C - Public IP from file descriptor

提交回复
热议问题