当前位置:编程学习 > C#/ASP.NET >>

c# tcp ip Sockets 实例

C#客户端和服务器端传递信息,主要是想学习下原理,所以如果有例子或详细注解的代码最好!先谢谢了!先给50分!没别的意思,其实大家在这里学习都不在乎这个!
补充:不好意思!我邮箱415630922@qq.com 或直接加qq415630922讨论

答案:留下邮箱

我发给你

楼上的是c++的吧 服务器端:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net;using System.Net.Sockets;using System.Threading;namespace test4_1 public void listbox(string str) //开始监听 private void Listen() catch (Exception e) } //接受请求回调函数,并在该回调函数中调用接收数据 public void acceptCallback(IAsyncResult ar) //接收数据回调函数 public void readCallback(IAsyncResult ar) catch(Exception ex) } private void send(string str) private void sendCallBack(IAsyncResult ar) private void buttonSend_Click(object sender, EventArgs e) }}客户端:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net;using System.Net.Sockets;using System.Threading;namespace test4_2 public void listbox(string str) //连接方法 public void Connect() catch (Exception e) } //连接方法的回调函数 private void ConnectCallback(IAsyncResult ar) catch (Exception e) } public void receivecallback(IAsyncResult ar) catch } //发送方法 private void Send(String data) //发送方法的回调函数 private void SendCallback(IAsyncResult ar) catch (Exception e) } private void buttonSend_Click(object sender, EventArgs e) }} 0

上一个:Visual C# 2008 Express Edition 在哪有下载?就是能支持Visual Studio 2008以上版本的,我是新手,不知道学习C#要什么工具。
下一个:c语言,C++,C#有什么区别和共同点

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,