At the moment I use
serverOutput = new DataOutputStream(socketCliente.getOutputStream());
and then
serverOutput.write(data.getBytes());
and it works fine UNTIL I add any non standard characters (for example ñ) and then as many characters I add, that number of characters are cut from the end of the file and don't arrive.
Full source code is available here in PandroidAgentTentacle.java
http://pandora.svn.sourceforge.net/viewvc/pandora/trunk/pandora_agents/android/src/pandroid/agent/
getBytes(String charsetName)orgetBytes(Charset charset). You will also have to specify the charset on the reciever's side. Sending some end-of-data marker would also be handy (or prefix a length).