hagar
hagar

Reputation: 11

Is there a way for a java chat client program to dynamically find the host server?

I want to just execute an instance of client with no parameters other than the port number and have the program find the server listening on that port anywhere on the network.

Upvotes: 1

Views: 261

Answers (1)

Peter Lawrey
Peter Lawrey

Reputation: 533530

You can use UDP multi-cast to find the server. You can send a UDP packet to the port and have the server respond with its IP address. (This effectively hard codes a multi-cast address) which is not much better than hardcoding a hostname which can be looked up via DNS.

Upvotes: 1

Related Questions