Server reply not coming through

djb dbrownell83 at hotmail.com
Tue Jun 1 10:17:48 EDT 2010


Hi,

I've written my first Netty server, which hosts a program for C++ clients... 
It receives a request, processes and replies.  But at the moment, I'm still
testing a Java-Java version.  

Please disregard my previous post, if it was not deleted.

I'm using the IntegerHeaderFrameDecoder from the Javadocs, and am receiving
my client's messages.  But when I reply in my server's message handler, it
goes ahead and writes the bytes, and the server thinks the connection is
still open...  but the client gets -1 (EOF).

Is there some kind of flush, for the server side?  What is going on?

------------------------------------------
Client code:
------------
socket = new Socket("localhost", MultiThreadedClient.port);

BufferedOutputStream out = new BufferedOutputStream(
		socket.getOutputStream());
BufferedInputStream in = new BufferedInputStream(
		socket.getInputStream());

byte[] data = claim.getBytes("UTF-8");

out.write( getByteInt(false, data.length));
out.write( data ); 
out.flush();
System.out.println("Sent claim to server.");

------------------------------------------
Goes to this Server code:
------------
//(receives request, sends back results)
byte[] data = results.getXMLString().getBytes("UTF-8");
      
ChannelBuffer replyBuffer = (ChannelBuffer)e.getMessage();
replyBuffer.writeInt(data.length);
replyBuffer.writeBytes(data);
----------------------------------------
Comes back to client:
------------

int ch1 = in.read(); //-1
(and more code...)
------------------------------------------

Please advise why the client gets EOF, when the server thinks the connection
is still open.  

Thanks
Daniel
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Server-reply-not-coming-through-tp5126180p5126180.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list