channel.write() problem when sending message from server to client
Boltosaurus
k.meiklyar at gmail.com
Mon Jul 25 11:27:57 EDT 2011
Hi, dear friends.
I'm developing server side application for online game. When client
application is connecting to server, channel is added to ChannelGroup and C
and S applications are interacting with each other by sending text messages.
Server application receives client messages in the right way.
But I found myself in very strange situation. I have a handler class that
extends SimpleChannelHandler and overrides it's function messageReceived
like this:
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
final ChannelBuffer s = ChannelBuffers.dynamicBuffer();
s.writeBytes(("got your message: " + "you are: "
+ e.getChannel().toString() + " your message was: " + e
.getMessage()).getBytes());
e.getChannel().write(s);
}
And it works just fine.
But if I remove "+e.getMessage()" when writing to buffer and just write smth
like "s.WriteBytes(("123").getBytes);" the client doesn't recieve the
message.
My Pipeline class also contains StringDecoder and StringEncoder, so seems to
me, the problem is not there.
I will be glad if someone can help me with a better way to send messages
between C and S or just will be able to find where is the problem.
Thank you
------------
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/channel-write-problem-when-sending-message-from-server-to-client-tp6618733p6618733.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list