I have a java server, that can send any kind of file, but I can’t manage to send a string or a integer.
Here is an example of how the file is sent.
File f = new File("/Users/Large/Downloads/android.jpg");
FileInputStream fis = null;
int size = (int)f.length();
byte[] bytes = new byte[size];
fis = new FileInputStream( f );
fis.read( bytes );
System.out.println("entro...");
out.write( bytes );
out.flush();
Try replacing your call to
out.write(bytes)with these examples that use the String and ByteBuffer classes.:Note that at some point you will need to care about endianness and character encoding to have something at the other end read these values in a reliable way.