本文介绍了用netty摇摆客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有一个java代码示例,展示如何将java swing GUI连接到netty 3.2.7?

Does anyone have a java code example showing how to connect a java swing GUI to netty 3.2.7?

目前我已经向服务器发送了一条消息通过netty客户端类。 netty客户端处理程序正确接收服务器响应(在 messageReceived 方法中)。

Currently the GUI I have sends a message to the server via a netty client class. The server response is correctly being received by the netty client handler (in the messageReceived method).

问题是将此响应恢复到GUI的正确方法是什么。

The question is what is the correct way of getting this response back to the GUI.

当然,应用程序有许多不同的GUI需要执行相同类型的功能 - 即发送来自java swing GUI的消息,在netty客户端处理程序中接收响应(在 messageReceived 方法中),在java swing GUI中接收此消息。

Of course the application has got many different GUI's which need to perform the same type of function - i.e. send message from java swing GUI, receive response in netty client handler (in messageReceived method), receive this message in the java swing GUI.

推荐答案

那取决于有多个解决方案。一个可能是向ChannelHandler注入一个监听器,然后在收到消息后会收到通知。另一种解决方案可能是在收到消息后将事件发送到主题并在主题上注册感兴趣的摆动部分,以便他们得到通知。

Well It depends as there are more then one solution. One could be to inject a listener to the ChannelHandler which then will get notified once the message was received. An other solution could be to send events to a topic once a message was received and register the interested swing parts on the topic, so they get notified.

这篇关于用netty摇摆客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 15:58