channel.write() problem when sending message from server to client
"이희승 (Trustin Lee)"
trustin at gmail.com
Mon Jul 25 16:15:37 EDT 2011
Hi,
That's interesting. The client might be somehow discarding the received
data. Did you check if the message (i.e. "123") is actually written out
to the wire using packet monitors like Wireshark?
HTH
Boltosaurus wrote:
> 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.
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
--
Trustin Lee, http://gleamynode.net/
More information about the netty-users
mailing list