通过网络传递序列化数据(Passing serialized data over network)

   IT问题网   2021-02-23 00:00:00

问 题

嘿,

我在客户端上反序列化一个对象有问题,我已经发送了socket.send,并尝试用socket.begingrecieve接收。



 private sub waitfordata()
尝试
如果m_pfncallback什么都没有那么
m_pfncallback =新的asynccallback(addressof ondatareceived)
结束如果
dim thesocpkt as new socketpacket()
thesocpkt.thissocket = m_clientsocket
''开始异步监听数据
m_result = m_clientsocket.beginreceive(thesocpkt.databuffer,0, thesocpkt.databuffer.length,socketflags.none,m_pfncallback,thesocpkt)
catch se as socketexception
messagebox.show(se.message)
end try

end sub

private sub ondatareceived(byval asyn as iasyncresult)
尝试
dim thesockid作为socketpacket = directcast(asyn.asyn) cstate,socketpacket)
dim totalbytestoread as integer = thesockid.thissocket.endreceive(asyn)

''我如何到达服务器发送的所有字节?
dim bytearr()as byte =''序列化对象的所有字节

dim obj as object
obj = deserialize(bytearr)


waitfordata()
catch generatedexceptionname as objectdisposedexception
system.diagnostics.debugger.log(0,"1",vblfamp;"ondatareceived:socket已关闭"amp; vblf)
catch se as socketexception
messagebox.show(se.message)
结束尝试
结束子






谢谢。

解决方案

看一下我的文章 wcf杀手。

它在c#中,但它会做你想要的,你不必调试它。

标签:通过网络传递序列数据



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

程序显示按完成时间排序的跑步者,其中一列显示其年龄组内的完成位置(排名)。(Program to display the runners sorted by finish time with a column showing their finish position (ranking) within their age group.)

problem you have a list of runners and their race times a ...

如何调试我的xpath并检查它是否存在一些问题?(How to debug my xpath and to check if there are some problems in it )

problem hi,everyone! now i have a xml file and it looked ...

用户界面设计(User interface Design)

problem hi, i want to design all the user interface scree ...

在ASP.Net中拖放图像(Drag and drop image in ASP.Net)

problem hi, i saw "the drag and drop image i ...

任何人都可以帮助解决'/'应用程序中的服务器错误。(Can any one help dis error Server Error in '/' Application.)

problem hi every one i am upload one .aspx p ...

灰度图像处理(Gray Scale image Processing)

problem hi i want cut the image from pattern the output o ...

如何从javascript调用jsp页面(How to invoke jsp page from javascript)

problem how to invoke jsp page from javascript solution h ...

如何为字符串附加字符。(How can I append characters for a string .)

problem hello all, i have to append lt;stxgt ...

C#Yahoo Messenger注册表观察者(C# Yahoo Messenger registry watcher)

problem hi, my name is nicusor, i have found this code on ...

想要开始编码DMP打印机(Want to start Coding For DMP Printers)

problem hii.......... friends i want to sta ...

如何获取放置在gridview行中的服务器控件的客户端ID(How to get Client id of server control placed in gridview row)

problem hi i am creating row in gridview dynamicaly, hav ...

制作“制作文件”时出错UNIX(Error while making "Make File" unix)

problem i have 7 files which are as follows:; -hw1.cpp -m ...

邀请Facebook好友加入asp.net(Invite Facebook friends in asp.net)

problem hello all, how can i invite facebook friends usin ...

从另一个文件夹获取数据相同的解(get data from another folder same solution)

problem hello, i have a solution which consist of a folde ...

datagridview头过滤器(datagridview header filter)

problem i''ve been trying to make my datagridview filter ...

如何开展基于varoius网络安全攻击检测和分析的项目(how to carry out a project on detection and analysis of varoius netwrok based security attacks)

problem hello, i want to know about how projects on vari ...

Sharepoint设计器中的正则表达式(Regular Expression in Sharepoint designer)

problem hi friends, i am facing problem in applying regu ...

使用C#创建水晶报表模板(Create crystal report template using C#)

problem hi guys... can someone guide me on wh ...

CPU寄存器的副本(copy of CPU registers)

problem hi all, while studying about sharing resources i ...

Reg:Windowsw表单保存到数据库(Reg:Windowsw form save to database)

problem how to give coding to save button for ...