This problem may have nothing to do with java on linux, but
I thought i might ask and see if anyone knows what is 
happening. I am having many problems with sockets in java and I'm not
sure whether I'm missing something or if something else is
wrong.

I have a java server and a C client.

First, the server's DataOutputStream.writeBytes() method seems to be
doing something else in addition to writing bytes to client. I infer
this because the client's "read" function never returns 
more than 1 reflecting only 1 byte is being read even though
the server is sending 2 bytes.

***
         --  JAVA method called in server --
        clientsocket_out.writeBytes("OK"); 

          -- C client function called --
        n = read(sockfd, recvline, 15); (n is 1 and recvline
        is "O", but n should be 2 and recvline should be "OK")

***

If I use clientsocket_out.write(buf) where buf is a byte
array and buf.length is 2, the C "read" function works just
fine. In this case n is 2 reflecting that 2 bytes were read and
recvline contains the 2 bytes sent by the server.

Anyone have any idea why this is?

Also, no matter what I do, I can't seem to pass more than
1460 bytes to a DataOutputStream (Socket) using the write
method. Lets say I have byte buffer[]=new byte[30000] and 
I call the method clientsocket_out.write(buf), I expect that 
write will write 30000 bytes to the dos, but instead the client 
reports that only 1460 bytes have been read. Is this because of 
TCP MTU or some other limitation?

Thanks,

Mark

Reply via email to