• Post Reply Bookmark Topic Watch Topic
  • New Topic

Find a Server of unknown IP  RSS feed

 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I find a server that I do not know the IP for?

Scenario: Friends come over and we all get a wifi connect and one of us will host, so the others will be clients. We are all going to be on the same subnet, is there a way short of trying every IP in a range to see if the host is there or manually looking up the IP and saying: "Hey everyone I'm going to be the host tonight, so everyone..."
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to do this is a UDP multicast or broadcast.
In multicast, the application running on all devices joins a hardcoded multicast IP address and listens. One of the devices decides to become the server and advertises itself by sending its IP address in a UDP to the multicast address. The router then forwards that UDP to all members of the multicast group.
Same with broadcast, except that router forwards that packet to all devices on the subnet, and whoever's listening on broadcast address receives it.

A more formal way of doing the same thing is using SSDP (Simple Service Discovery Protocol), which also uses multicasting.
 
Les Morgan
Rancher
Posts: 752
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds perfect for what I want. Thank you.

Karthik Shiraly wrote:One way to do this is a UDP multicast or broadcast.
In multicast, the application running on all devices joins a hardcoded multicast IP address and listens. One of the devices decides to become the server and advertises itself by sending its IP address in a UDP to the multicast address. The router then forwards that UDP to all members of the multicast group.
Same with broadcast, except that router forwards that packet to all devices on the subnet, and whoever's listening on broadcast address receives it.

A more formal way of doing the same thing is using SSDP (Simple Service Discovery Protocol), which also uses multicasting.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!