谁能给个简单的完成端口的例子

ljn2 2007-02-28 03:29:06
下载了几个,由于其加入了自己的逻辑等等,弄得挺复杂,反倒看不懂了。
...全文
413 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
sz2007 2007-03-07
  • 打赏
  • 举报
回复
在 win32多线程程序设计 里有个例子。

ljn2 2007-03-01
  • 打赏
  • 举报
回复
up
蒋晟 2007-03-01
  • 打赏
  • 举报
回复
http://support.microsoft.com/kb/197728
ideawu 2007-02-28
  • 打赏
  • 举报
回复
"Windows 网络编程第二版"里的.
// Assume we have a connected socket named MySocket

PerIOData PData;
PData.s = MySocket;

public AsyncCallback AsyncReceiveCallback = new
AsyncCallback(ProcessReceiveResults);

MySocket.BeginReceive(PData.Buffer, 0, PData.Buffer.Length,
SocketFlags.None, AsyncReceiveCallback, PData);



public static void ProcessReceiveResults(IAsyncResult ar)
{
PerIOData PData = (PerIOData) ar.AsyncState;

int BytesReceived = PData.s.EndReceive(ar);

// Do something about your received results
. . .
}

public class PerIOData
{
// Put whatever data you need here for the delegate method.
// Most applications will probably define the data buffer
// here for the received data.
byte [] Buffer = new byte[4096];
Socket s;
. . .
}
abrams2004 2007-02-28
  • 打赏
  • 举报
回复
《Windows网络编程技术》,下载源码,上面有例子的
HelloWorld_GHH 2007-02-28
  • 打赏
  • 举报
回复
看《Windows网络编程技术》里边讲的比较好。
wangk 2007-02-28
  • 打赏
  • 举报
回复
只有自己写的自己看的最清楚。

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧