Failed to build a middleman to pass connection between a server and a client
Norman Maurer
norman at apache.org
Mon Jan 17 03:06:35 EST 2011
Please Show me the stacktrace and Tell me which line Throws it...
For example I don't see where the currentchannel is Set.....
Bye
Norman
Am Montag, 17. Januar 2011 schrieb egg86 <egg86_tam at yahoo.com>:
>
> Hi Norman,
>
> I have Server and serverInterface bind together, and Client and
> clientInterface bind together. When Client send a string to clientInterface,
> clientInterface will call a public method in serverInterface to parse the
> string message to protocol buffer message to Server.
>
> Below is how the clientInterface call the serverInterface to send out
> protobuf message:
>
> @Override
> public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
>
> //connect string will be received here
> String requestMessage =(String) e.getMessage();
> System.out.println("\n-->messageReceived("+this+"):server receive
> "+requestMessage.length()+" bytes.\n"+requestMessage);
>
> serverInterface client = new serverInterface ();
> client.SendMessage(requestMessage);
>
>
> }
>
> which on serverInterface side will handle the call:
>
> public void SendMessage(String receivedMessage) {
>
> if(receivedMessage.equalsIgnoreCase("connect")) {
>
> Message.Builder builder = Message.newBuilder();
>
> builder.setMessageCode(
> MessageCode.newBuilder().
> setMessageId(MessageId.valueOf("CONNECT")).
> setMessageTypeId(MessageTypeId.valueOf("TYPE_NOTHING"))
> )
> .setMessageContent(
> MessageContent.newBuilder().
> setRequestId(generateRequestId()).
> setCsIdentificationNumber(1122334455)
> );
>
> Message message = builder.build();
>
> ChannelFuture lastWriteFuture = null;
>
> lastWriteFuture = currentChannel.write(message);
>
> }
> }
>
> Is this approach correct, because I can't get this part successfully done.
>
> thanks in advance.
> --
> View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Failed-to-build-a-middleman-to-pass-connection-between-a-server-and-a-client-tp5930926p5931002.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
>
More information about the netty-users
mailing list