I have some experience using the Socket class and ServerSocket class in the java.net package.
However, I want to be able to connect to my Server using a domain name instead of having to know the IP of the server.
Right now of course I just tell my client to connect to 127.0.0.1 but I'd like to be able to have clients connect to the server without having to know my exact IP. Using a domain name or my computer name?
Anyone have ideas?
Also, when creating a chat program using the aforementioned classes, if your server recieves multiple requests from various clients would you create a separate socket for each client to talk to the server or could you use threads to let multiple clients use one socket, one port?
The help is very much appreciated.
A question: how do you have a server that doesn't have a domain name?
If your client connects to your server via: localhost ie 127.0.0.1 they are NOT on the internet, they are purely local. Could you explain this?
Or is your server a personal one that you run on your computer which connects to the net via dialup and gets a unique IP address every time you connect?
There are IP lookup routines that will look in the DNS tables and return the domain address for an IP address. Try google.
Ok I phrased my question poorly.
1) I want to create a server program in Java
2) have clients connect to that server
What are the options available for them to connect if the server program is running on my computer?
Must they know my IP or is it possible they can use my computer name or something of the like?
What kind of connection do you have with the internet? Do you have the same IP address everytime or does it change like with dial-up connections?
If its constant, there might be a "domain-name" associated with it.
I use the following site to translate IP addresses to "domain/text" addresses:
Otherwise your users would type in something like: http://18.104.22.168
which may be shorter than the IP address
If you get a new IP address everytime, that makes it harder. One way to fiddle it would be to get a fixed site that you can place some HTML page on. Have that page do a redirect to your current site. You would have to update it every time that you connected with a new IP address so it would redirect to your new address.