Eogcloud
Eogcloud

Reputation: 1365

Java tcp/ip sockets

Quick question regarding this

Socket(String host, int port)

If I use these arguments in a client, how would a specify the server have a name and thus reference it in the client?

EDIT

Please excuse me if it's vague. I'm writing and instant messenger in java and using this constructor for the client side socket, it wants to receive the host's name as a string and the host's port as a int. What I'm asking is how do I set/find the host's name in this case?

For example, is the String simply "127.0.0.1" if I'm running it locally? Or is it a specified name like "JavaServer" that I set somewhere somehow?

Upvotes: 0

Views: 338

Answers (1)

dty
dty

Reputation: 18998

Well, you could read the documentation for that constructor :-)

It's either a host name (e.g. "chatserver.domain.com") or and IP address as a String (e.g. "192.168.1.10")

Upvotes: 2

Related Questions