您现在的位置是: 软件 > 开发者网络 > 微软开发专栏 > Visual Studio.net专栏 > C#专区 > 正文


-Win xp中的多种网络
-试验试验试验试验
-用Freehand实现位图矢量化
-网络电话面面观

C#实时申请技术
2001-12-01· ·crystal编译··yesky

1 2 3 4  下一页


  Real time Application 实时申请技术在本文里是作为一个实例来演示在用户(Tcpclient)申请与服务器(TcpServer)申请之间使用Socket类的情况 。该项目同样也演示在实时项目中如何使用listview控制以及如何传递XML格式信息。

  TcpServer.exe 文件显示了在单独的thread当中(而不是在GUI 线程之中)TCP socket的相互通讯。

  TcpClient.exe文件同样也使用一条单独的线程 从Socket中读取数据,然后对表单中的list view控件进行更新。

  步聚如下:

  1.TcpServer 监听端口8002,并且发射线程等待客户端连结。

Hashtable socketHolder = new Hashtable();

Hashtable threadHolder = new Hashtable();

public Form1()

{

 // Required for Windows Form Designer support

 //

 InitializeComponent();

 tcpLsn = new TcpListener(8002);

 tcpLsn.Start();

 // tcpLsn.LocalEndpoint may have a bug, it only show 0.0.0.0:8002

 stpanel.Text = "Listen at: " + tcpLsn.LocalEndpoint.ToString();

 Thread tcpThd = new Thread(new ThreadStart(WaitingForClient));

 threadHolder.Add(connectId, tcpThd);

 tcpThd.Start() ;

}

1 2 3 4  下一页

【责任编辑:方舟】
【发表评论】【关闭窗口】
■ 相关内容
 C#中的远程执行和分布式计算
 Visual C#的剪切板编程
 用Visual C#动态生成组件
 .Net平台Windows Forms程序设计简介
 用Visual C#做托盘程序
 用C#实现基于TCP协议的网络通讯
 WinForm中的ListBox组件编程
 使用UDDI的Web服务描述和发现之二
 C#:消息队列应用程序
 WEB应用中报表打印的实现
 在Visual C#中用ListView显示数据记录
 如何用CSC.exe来编译Visual C#的代码文件
 在Visual C#中访问不同数据库
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!