I’m trying to implement a JAVA UDP-based Chat server.
I need to implement a server that allows me to connect via netcat.
The main problem is that I must connect like this: (the run-example is this one):
Server –> java ServerUDP
Client –> nc HostName
How can I create a named Host? I mean, I can connect via:
nc -u localhost 7777
But if I would like to connect like this:
nc myServer
How should I implement it in Java?
Binding an IP address to a domain name isn’t related to your java server. You have to implement nothing.
Assuming you are using GNU/Linux, if you need to resolve a name locally to your pc you can simply edit /etc/hosts:
If you need to resolve from every pc in your lan, you can setup a DNS server.
If you need to reach that node from everywhere, you need to buy a domain name from a DNS authority.
Whatever situation you are in, it has nothing to do with your Java code.