How to send an object with Netty?

时光怂恿深爱的人放手 提交于 2019-12-23 17:12:44

问题


How to send bean from server side and receive this bean in the client side by Netty? When I send simple integer message, inputstream, it works successfully but I need to send bean.


回答1:


If you are using netty at client and server side then you can use the Netty ObjectDecoder and ObjectEncoder in your ChannelPipeline to send and receive objects.

Take a look at the netty ping pong example which does this. The code is bit out of date, but you will get the general idea on working with objects.



来源:https://stackoverflow.com/questions/8310786/how-to-send-an-object-with-netty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!