0
votes

I currently have a problem with a Java server thingy.

It's a simple TCP server which send images. Problem is, I don't have the code of the client program... Moreover, it seems that there is no way to check the client socket for writing event nor the amount of data already sent to the client.

Do someone have any idea about what could prevent the client to get the image correctly ?

Here's my code :

byte[] response = process ( cmd );

if ( response == null )
{
    controlSock.close();
    dataSock.close();
    stop = true;
}
else if ( dataSock != null )
{
   dos.write( response );
   dos.flush();
}

By the way, the server is working fine with Telnet.

1
Insufficient Info. What's the protocol? Are there Stacktraces, Errorlogs? Can you name the Client? Do you get IOExceptions? ... - Fildor
Protocol is TCP (and homemade commands list). No, there is no apparent errors, and it's a client which was written by students. I know it's not much of information, but all seems to be working. Just the image is not received by the client. I would like to check how much data was send for example... Is that possible ? - Aleks
On what parts do you have influence? You have the server code, I guess, you do not have the client code. You know the application protocol. Can you change the protocol or make additions to it? - Fildor

1 Answers

2
votes

If the server works fine with telnet then your server is fine.

The problem is more likely to be in the assumptions the client is making are not the same as yours. for example the client might assume you are sending the size first in big or little endian format (as an int, short or long) Perhaps it expects the name of the file/image in some format as well.

The only way to know this for sure is to read the code for the client or ask someone who knows what assumptions the client makes.