In Boost ASIO how can I set the source IP address to impersonate another server's IP address?

前端 未结 2 749
情深已故
情深已故 2020-12-18 16:24

I have a Boost ASIO-based C++ server program and I\'d like to be able to set the source IP address used by TCP to that of another server. I know one can read the source and

2条回答
  •  自闭症患者
    2020-12-18 17:16

    Use bind call to assign the source IP address and port.

    If you do not call bind before connect the OS picks and binds the interface for you using the routing table.

    The IP address must be the address of one of your host's interfaces. In other words, you cannot spoof your source IP using bind call.

提交回复
热议问题