0

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.

3
  • 4
    Insufficient Info. What's the protocol? Are there Stacktraces, Errorlogs? Can you name the Client? Do you get IOExceptions? ... Commented Dec 13, 2012 at 10:11
  • 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 ? Commented Dec 13, 2012 at 10:19
  • 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? Commented Dec 13, 2012 at 10:54

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Addition: If on server side write and flush are being executed without any exceptions, you have to consider all the bytes of "response" have been written.
esp if you see them when using telnet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.