How to detect other hosts on LAN messenger using a single UDP port?
سؤال
As stated in the IP Messenger Help , it uses a UDP Port 2425 to detect other hosts. How does it actually achieves it with a single port??
How do I proceed to achieve this, like say create a socket, then broadcast and all the steps.
Any Ideas and Help would be greatly appreciated..
المحلول
- Create datagram socket()
- bind() the port
- prepare packet
- sendto() UDP packet to the broadcast (mulicast) address
- recvfrom() as many answer as you want
لا تنتمي إلى StackOverflow