Udp Problems
Opened this issue · 3 comments
I want to send message to remote address server, but i can't get the right methods.I have some issues that
Why in MainActivity, Server and Client only can Use localhost,when I use another ip,the system is running "01-11 17:36:54.573 8159-8171/com.github.renewb.androidasyncsocketexamples D/dalvikvm: GC_FOR_ALLOC freed 512K, 16% free 3110K/3688K, paused 1ms, total 1ms"
this is my setting:
server = new Server("192.168.x.x", 7001);
client = new Client("192.168.x.x", 7001);
can you give me some helps?
Sorry for late reply.
This is not sufficient information for me to help you with this. There could be a variety of issues causing this. You should check if the client and server can ping each other, that the port is open (i.e. it is possible to telnet between the two), there could be something with your code etc.
Thanks for your reply.
Your sample code as below:
new com.github.reneweb.androidasyncsocketexamples.tcp.Server("localhost", 7000);
new com.github.reneweb.androidasyncsocketexamples.tcp.Client("localhost", 7000);
I want to use "192.168.x.x" to replace "localhost", and did this,so cause that problem.
and this will cause "bind exception" at the same time.
can you give me some advises again?
So, I am guessing you are running this in the android emulator and you are using your computers IP address. If thats the case than the problem is that the emulators IP address is not the same as the one of the computer. You have to make sure to use the emulators IP to make it work and you should be able to retrieve it by using the following commands on a terminal while the emulator is running:
adb shell
ifconfig
This should connect you to the emulator and then show the network interfaces along with the IP's.