C++ Winsock API how to get connecting client IP before accepting the connection?

前端 未结 4 808
猫巷女王i
猫巷女王i 2020-12-21 03:31

I am using the Winsock API (not CAsyncSocket) to make a socket that listens for incoming connections.

When somebody tries to connect, how can I get their IP address

4条回答
  •  隐瞒了意图╮
    2020-12-21 04:01

    SO_CONDITIONAL_ACCEPT socket option. Here

    Also, pretty sure it's available in XP and Server 2003, not just Vista.

提交回复
热议问题