简体   繁体   中英

swing client with netty

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

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).

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM