Hi all
I create a server written by C++ which listens to the port 5555, and
than I write a client in Android emulator to connect to the server. From the
server log, the client have successfully connected to the server(the server
have created a new thread to deal with this connection). But when the client
wants to send packets to the server, error occurs with: "request time
failed: java.net.SocketException: Address family not supported by protocol".
Can somebody show me why this happens? The following is my codes:
Socket sock = new Socket("10.0.2.2", 5556);
boolean isConn = sock.isConnected();
Log.v("Socket Connection status ", String.valueOf(isConn));
// Outgoing stream redirect to socket
OutputStream out = sock.getOutputStream();
PrintWriter output = new PrintWriter(out);
output.println("Hello Android");
BufferedReader input = new BufferedReader(new
InputStreamReader(sock.getInputStream()));
String ret = input.readLine();
--
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