TCP client cannot read data from server

So, I have a TCP client running on an Androidt tablet, and I have a C ++ server running on a PC.

I send data from my tablet to a PC, and the PC can read it very well, but when the PC tries to send a message to the tablet, the tablet simply does not receive anything. He is stuck in a call readLine(), trying to read something.

So, here are the java methods sending and waiting for a response

@Override
protected Void doInBackground(Void... arg0)
{   
    String msg = "";
    Socket socket = null;
    DataOutputStream outToServer = null;
    BufferedReader msgFromServer = null;
    try 
    {
        // Socket used for I/O with the server
        socket = new Socket("192.168.20.100", 48501);

        // Writing to the server
        outToServer = new DataOutputStream( socket.getOutputStream() );

        // Reading from the server
        msgFromServer = new BufferedReader( new InputStreamReader( socket.getInputStream() ) );
        DataInputStream iStrReader = new DataInputStream( socket.getInputStream() );

        // Initial comm
        outToServer.writeBytes( "MainCamConnect" );

        msg = msgFromServer.readLine(); // Get stuck here
        Log.d( "NETWORK", msg );

        socket.close();

    } 
    catch( UnknownHostException e ) 
    {
        e.printStackTrace();
    } 
    catch( IOException e ) 
    {
        e.printStackTrace();
    }

    return( null );
}

and the message sent from the PC is: "StartDelayTest \ n"

I know that the server can send a message just fine, because I tested it with a simple C ++ TCP client, and it worked fine, but when I run it on the tablet, the tablet cannot get anything

EDIT:

OS: Windows 7 64 bit Professional Version

EDIT 2:

wirehark , , IP-, ( Android)

+3
2

public int read(char[] cbuf, int off, int len) , :

char[] buffer = new char[256];
int count = read(buffer, 0, 256);

readline .

0

, . writeBytes() . . readLine() , .

0

All Articles