Reputation: 843
I am creating one datagram socket in my application like below:
DatagramSocket socket = new DatagramSocket(60000,
InetAddrByName("192.168.1.72"));
This datagram constructor returns with exception
java.net.BindException: The requested address could not be bound.
I have added the android.permission.INTERNET to my manifest file. I am using iMac and Eclipse 3.4.2. I checked that port 60000 is free. Also 192.168.1.72 is my ip address. So what could be the problem?
Upvotes: 1
Views: 1106
Reputation: 262
from the dev site Referring to localhost from the emulated environment
If you need to refer to your host computer's localhost, such as when you want the emulator client to contact a server running on the same host, use the alias 10.0.2.2 to refer to the host computer's loopback interface. From the emulator's perspective, localhost (127.0.0.1) refers to its own loopback interface.
Upvotes: 1
Reputation: 4740
What do mean by "my ip address".
This is one of the addresses you see when you enumerate the NetworkInterface instances ON THE device?
Upvotes: 0