java - Interprocess communication between Android and C# -
attempting perform sockets communication between android , c# seem stuck.
this code have far.
android:
public void onclick(view v) { try { inetaddress serveraddr = inetaddress.getbyname("localhost"); socket mysocket = new socket(serveraddr, 666); } catch (unknownhostexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } c#:
tcplistener listener = new tcplistener(system.net.ipaddress.parse("127.0.0.1"), 666); listener.start(); using (socket socket = listener.acceptsocket()) { using (stream stream = new networkstream(socket)) { } } when hitting line socket mysocket = new socket(serveraddr, 666); in android application getting following error.
"java.net.connectexception: localhost/127.0.0.1:666 - connection refused"
anyone able guide me doing wrong?
ps: testing through emulator wondering if there possibly sort of limitation ability communicate other processes running on machine?
inside emulated machine address 127.0.0.1 not host's loopback interface, it's emulated machine's own loopback interface.
according emulator documentation can access host's loopback interface through special address 10.0.2.2.
Comments
Post a Comment