Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid UDP Client doesn't receive DatagramPacket
    primarykey
    data
    text
    <p>WiBro, which is used as a server module and client Nexus Galaxy ICS. Both machines are 3g UDP communication. The server will return only the received data has been implemented.</p> <p>dSocket.send (sendPacket) is a smooth communication. However, we have a problem. dSocket.receive (recvPacket) does not receive the data.</p> <p>The server sends the packet is wrong? If the client receives the packet is wrong? The server sends data but, telecom equipment is taken to preserve the situation?</p> <p>When only sending a packet, the client has not a problem. but after receive code implementation, the client has a problem.</p> <pre><code>private class ClientThread implements Runnable{ @SuppressWarnings("finally") @Override public void run() { // TODO Auto-generated method stub DatagramSocket dSocket = null; try{ InetAddress serverAddr = InetAddress.getByName(serverIpAddress.toString()); Log.d(TAG, "Connecting"); Log.d(TAG, "IP :::: " + serverAddr.toString()); dSocket = new DatagramSocket(SERVERPORT); dSocket.setSoTimeout(5000); byte[] arr_RecvPacket = new byte[1024]; connected = true; while(connected){ try{ Log.d(TAG, "Sending Command :::: ( " + String.valueOf(i)); String strPacket = "Hey Server ( " + String.valueOf(i); byte[] arr_Packet = strPacket.getBytes(); sendPacket = new DatagramPacket(arr_Packet, arr_Packet.length, serverAddr, SERVERPORT); dSocket.send(sendPacket); Log.d(TAG, "C:Send"); i++; Log.d(TAG, "C:Make Recv Packet...."); recvPacket = new DatagramPacket(arr_RecvPacket, arr_RecvPacket.length); Log.d(TAG, "C:Recving..."); dSocket.receive(recvPacket); handler.sendEmptyMessage(0x01); Thread.sleep(4000); }catch(Exception e){ e.printStackTrace(); Log.d(TAG, "S:Error"); } } Log.d(TAG, "S:DataSocket close"); dSocket.close(); }catch(Exception e){ Log.d(TAG, "C:Error"); e.printStackTrace(); connected = false; }finally{ connected = false; if(dSocket != null){ dSocket.close(); } return; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload