Hi,
I'm trying to connect two Android emulators in one pc using TCP. One
of them is the server and the other is the client.
I have readen the Android Help:
http://developer.android.com/guide/developing/tools/emulator.html#connecting
about Interconnecting Emulator Instances. But I think that I'm doing
something wrong in my code.
First of all, the emulator 5554 is the server, I do a telnet like:
telnet 127.0.0.1 5554 and then in the console, I do: redir add tcp:
9999:6000 = redir add tcp:<localport>:<serverport>
My server code is:
....
try {
Log.d(Tag, "Creating SS");
tmp = new ServerSocket();
} catch (IOException e) {
Log.d(Tag, "Error SS");
}
mServer = tmp;
try {
mServer.bind(new InetSocketAddress("10.0.2.15",
6000));
} catch (IOException e1) {
Log.d(Tag, "SS dir IP&Port not created");
}
try {
tmp2 = mServer.accept();
} catch (IOException e) {
Log.d(Tag, "Error");
}
mSocket=tmp2;
....
My client code is:
clientSocket = new Socket();
try {
Log.d(TAG, "ClientSocket creating");
clientSocket.connect(new InetSocketAddress("10.0.2.2", 9999));
Log.d(TAG, "ClientSocket creating");
}
catch (IOException e) {
Log.d(TAG, "No se ha creado el ClientSocket");
}
Thank you!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en