Note that there are some explanatory texts on larger screens.

plurals
  1. PODataOutputStream, does it lose some bits
    primarykey
    data
    text
    <p>I'm writing a client server application, but I don't receive the same bytes at the client side when they are sent from the server side. At the server side I used <code>.write(bytes[])</code> method. At the client side, I used <code>.readFully(byte[])</code> method. Do you have any idea ?</p> <p>The sent code:</p> <pre><code> System.out.println("Server got connection from " + connectionFromClient.getPort()); in = connectionFromClient.getInputStream(); OutputStream out = connectionFromClient.getOutputStream(); DataOutputStream dataOut = new DataOutputStream(out); LicenseList licenses = new LicenseList(); String ValidIDs = licenses.getAllIDs(); System.out.println(ValidIDs); Encryption enc = new Encryption(); //byte[] dd = enc.encrypt(ValidIDs); byte[] dd = enc.encrypt(ValidIDs); String tobesent = new String(dd); //byte[] rsult = enc.decrypt(dd); //String tt = String(rsult); System.out.println("The sent data**********************************************"); System.out.println(dd); String temp = new String(dd); System.out.println(temp); System.out.println("*************************************************************"); //BufferedWriter bf = new BufferedWriter(OutputStreamWriter(out)); dataOut.write(ValidIDs.getBytes()); dataOut.flush(); System.out.println("********Testing**************"); System.out.println("Here are the ids:::"); System.out.println(licenses.getAllIDs()); System.out.println("**********************"); </code></pre> <p>The client Side:</p> <pre><code> Socket connectionToServer = new Socket("127.0.0.1", 7050); InputStream in = connectionToServer.getInputStream(); DataInputStream dis = new DataInputStream(in); int available = dis.available(); byte[] data = new byte[available]; // dis.readFully(data); dis.read(data); System.out.println("The received Data*****************************************"); System.out.println(available); System.out.println(data); System.out.println("***********************************************************"); </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.
 

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