vrbsm
vrbsm

Reputation: 1218

The communication problems between android and server using hostname

I'm using the socket service in my application

mSocket = new SocketIO("ip:port"); //work smoothly

However we need to use the "hostname" instead of ip. When I refer to "hostname", it means the "hostname" command in windows. The image below is the command I'm using.

enter image description here

When I use the hostname instead of ip

this way

mSocket = new SocketIO("hostname:port"); //not work

android launches an android error -

io.socket.SocketIOException: Error while handshaking with hostname. Unable to resolve host "null": No address associated with hostname

Upvotes: 0

Views: 76

Answers (1)

dsh
dsh

Reputation: 12213

The DNS server your device is configured to use does not have an entry for the name. Thus the name can't be resolved to an address. You need to configure your DNS correctly to be able to use names.

Upvotes: 1

Related Questions