English 中文(简体)
BeginReceive()是否得到BeginSend()寄出的一切?
原标题:Does BeginReceive() get everything sent by BeginSend()?

I m负责撰写一个既有服务器的一面,也有用户一面的方案,客户一方将连接由同一方案(但由另一个机构,通常是另一个机器)主办的服务器。 因此,我基本上控制了议定书的两个方面。

我正在使用<代码>BeginReceive()和BeginSend(在双方发送和接收数据。 我的问题是,这两项发言是否真实:

  1. 用电话开始接收()将给我整个数据,在接听功能被召唤时,用单一电话发送到BeginSend()。

  2. 采用“BeginSend()”电话将发送我通过的全部数据,并将通过单独电话接收。

两者实际上基本相同。

如果答案没有,那么我猜测的是,根据我对袖珍的解读,处理指挥的最佳方式是什么? I m 撰写一场有指挥力的游戏,如<代码> PUT X Y。 我指的是在每一指挥所结束时将特殊性质(#,例如),每当我收到数据时,我就把数据推到缓冲,然后在我遇到<>#后加以压缩。

最佳回答

页: 1 BeginSend。 您可以发送<代码>的>>><>>>>>数据<>,这完全可以分为几类。 您可以单独收到电话。

两种主要方式是:

  • Use a delimiter (as per your current suggestion). This has the benefit of not needing to know the size beforehand, but has the disadvantage of being relatively hard to parse, and potentially introducing requirements such as escaping the delimiter.
  • Prepend the size of each message before the message. The receiver can read the length first, and then know exactly how much data to expect.
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签