apiipadhoc

Get other's IP address in ad hoc network


I set an ad hoc network between 2 computers and I want to know if there is any way to get other's pc IP address programmatically.

If anyone knows any API or function, it's welcome.

Thanks.


Solution

  • You do not mention what platform or language that you are using, so its hard to make suggestion. What you should know is that IP is a network level protocol and adhoc, such as wifi, is link level mode. As such there is no difference in learning the IP address when you are ad hoc vs when you are in a different mode. If you are using a TCP socket, you can easily obtain the IP address from the socket. It its a UDP socket, you can get the source address from a received packet. The specifics depends on your platform.