Hi all, I have the following problem:
My server sends the string str="1 2 4 dds \n" continuously to a C++ client.Here is the java code of the server:

Java Code:
	private class SendingThread implements Runnable{

	    	public Socket s;
	    	public DataOutputStream oo;
	    	public ObjectInputStream oi;
	    	////private QueryTransferObject q;
	    	boolean connected;


			public SendingThread() {
				// TODO Auto-generated constructor stub

	        public void run() {
	            try {
	                Socket s = new Socket("",8080);
	                connected = true;
byte[] str;
str=new byte[25600];
str="1 2 4 dds \n".getBytes();
	                while (connected) {
	                    try {

	                    		ObjectOutputStream oo=new ObjectOutputStream(s.getOutputStream());

	         		        	System.out.print("send \n");
	         //		        	Log.d("SendingThread", "C: Send data object finished.");
	         				//	connected = false;

	                    } catch (Exception e) {
	        //                Log.e("SendingThread", "S: Error", e);
Here is the partial C code of the client:
Java Code:
     if (bind(sockfd, (struct sockaddr *) &serv_addr,
              sizeof(serv_addr)) < 0) 
              error("ERROR on binding");
     clilen = sizeof(cli_addr);
     newsockfd = accept(sockfd, 
                 (struct sockaddr *) &cli_addr, 

     printf("I am here\n");
     if (newsockfd < 0) 
          error("ERROR on accept");
     n = read(newsockfd,buffer,255);
     if (n < 0) error("ERROR reading from socket");
     printf("Here is the message: %s\n",buffer);

The client keeps display this result:

I am here
Here is the message: �
I am here
Here is the message: w
1 2 4 dds

It seems that the message is not received correctly. Can anyone give some insight on how to fix it ? Thank you!