如何使用套接字传输对象? [英] How to transfer a object using sockets?

查看:74
本文介绍了如何使用套接字传输对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用套接字从客户端向另一个客户端发送一个对象,并获取客户端中接收到转换为字节数组的对象的对象。请大家帮忙并给出一些简单的例子。谢谢!

I want to send an object from the client to another client using sockets and get the object in the client who receives the object which is converted to byte array.Beg for your help and give some simple examples.Thanks!

推荐答案

您必须序列化对象,使用socked发送序列化数据,然后在接收端进行反序列化。
You have to serialize the object, send the serialized data using the socked and then deserialize it on the receiver side.


套接字示例 [ ^ ]。 序列化示例 [ ^ ]。


这篇关于如何使用套接字传输对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆