求一个 Winform +linux socket头文件...

求一个简单的C# winform TCP同步socket能成功传输结构体数据的客户端和服务器程序 急_百度知道
求一个简单的C# winform TCP同步socket能成功传输结构体数据的客户端和服务器程序 急
我一直在线,悬赏有点低,主要是最近用的有点多
提问者采纳
结构体,可以先序列化成二进制,在传输,接收后,再反序列化。如果你要着解决这个难题,可以用remoting 或wcf 看看。
我不会那两方面的。我在网上找到一个范例,但是不会做,或者说做得不对?你能抽空帮我看看么?就是这个。我也用的是winform的。不用网页的,最近时间有点紧,所以才着急的
你的问题是什么?我觉得他写的很清楚啊。
我可以把我根据他做的东西发给你么?我也不知道哪错了。我先去见一下老师,可能要回来发了
你打包下,给我看看。
回来了,已发送,就是那个person.cs什么的不会,上面说用什么类库不懂啊,尴尬,谢谢了,麻烦你把它调试出来就行了
提问者评价
其他类似问题
按默认排序
其他3条回答
我有个很简单的聊天室应该符合你的要求,你要的话可以看一下!
谢谢你,聊天的我会,书上有范例,就剩数据传输这部分了,不管怎样阁下发吧,谢谢了
百度下OICP吧
我有一个,要的发邮件给我。
邮箱呢?我的邮箱:
结构体的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁当前位置: >
> 求一个C#(winform)程序Demo,要求用线程池实现SOCKET通讯,有服务端和客户端。在线
求一个C#(winform)程序Demo,要求用线程池实现SOCKET通讯,有服务端和客户端。在线
tongxin0123 & at
求一个C#(winform)程序Demo,要求用线程池实现SOCKET通讯,有服务端和客户端。在线等。。求一个C#(winform)程序Demo,要求用线程池实现SOCKET通讯,有服务端和客户端。在线等。。各位大侠来解啊!!!
服务端  C# code  using S
using System.N
using System.Net.S
using System.T
using System.T
namespace SocketDemo
static class Program
static void Main(string[] argv)
Socket sktltn = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sktltn.Bind(new IPEndPoint(IPAddress.Any, 12345));
sktltn.Listen(30);
while (true)
Socket sk = sktltn.Accept();
ThreadPool.QueueUserWorkItem(p =&
Socket skc = (Socket)
byte[] array = new byte[10240];
int offset = 0;
while (true)
int len = skc.Receive(array, offset, array.Length - offset, SocketFlags.None);
if (len == 0)
string content = Encoding.UTF8.GetString(array, 0, offset);
Console.WriteLine(&& & + content);
tongxinoo & &
& & (0)(0)把这段另起一个线程就不会阻塞ui线程了  C# code  new Thread(new ThreadStart(delegate{
Socket sktltn = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sktltn.Bind(new IPEndPoint(IPAddress.Any, 12345));
sktltn.Listen(30);
while (true)
Socket sk = sktltn.Accept();
ThreadPool.QueueUserWorkItem(p =&
Socket skc = (Socket)
byte[] array = new byte[10240];
int offset = 0;
while (true)
int len = skc.Receive(array, offset, array.Length - offset, SocketFlags.None);
if (len == 0)
string content = Encoding.UTF8.GetString(array, 0, offset);
Console.WriteLine(&& & + content);
})).Start();tongxinhong & &
& & (0)(0)
本问题标题:
本问题地址:
温馨提示:本问题已经关闭,不能解答。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&&&湘教QS2-164&&增值电信业务经营许可证湘B2-求一个 Winform Remoting 实例_百度知道
求一个 Winform Remoting 实例
求一个Winform Remoting 实例,有Client 向Server髪送请求,然後服务器在整理完数据後再髪送到客户端。求过路大侠指教!或髪到我邮箱里:
WCF的双向通信的实例也到。最好是winform 版的。只要有简单的双向通信实现就好,完成后。我会再加分80;感谢过路大侠,你们辛苦了。^_^
提问者采纳
到找找看,或者codeproject上找
提问者评价
其他类似问题
remoting的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁其他回答(3)
不知道你碰到什么问题, 我们采用的是 DX里9.2 的 RichEditControl 处理中文没问题。
园豆:9932
MS标准的RichTextBox不行么?
可以试试C1的。
用htmleditor这个;你找找;winform的html编辑器;
&&&您需要以后才能回答,未注册用户请先。求一个WinForm 计时器_百度知道
求一个WinForm 计时器
一个label控件显示时间读数,一个按纽可以用回车或空格键控制,按第一次开始记时,再按停止记时,并把第一次的记时数据保存到一个文本文件里,再按读数清零开始记时,以此重复.我会追加重分的!!!!!
提问者采纳
偶使用 VS2003 为你编写,已通过调试:using Susing System.Dusing System.CponentMusing System.Windows.Fusing System.Dnamespace WindowsApplication1{ /// &summary& /// Form1 的摘要说明。 /// &/summary& public class Form1 : System.Windows.Forms.Form {
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private bool isStart =
// 记录是否启动
// 已经计时的次数
private DateTime beginT
// 记录启动时的时间
const string FileName = &C:\\time.txt&; // 保存日志的文件名
private System.Windows.Forms.Timer timer1;
ponentModel.IC
public Form1()
// Windows 窗体设计器支持所必需的
InitializeComponent();
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
/// &summary&
/// 清理所有正在使用的资源。
/// &/summary&
protected override void Dispose( bool disposing )
if( disposing )
if (components != null)
components.Dispose();
base.Dispose( disposing );
#region Windows 窗体设计器生成的代码
/// &summary&
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// &/summary&
private void InitializeComponent()
ponents = ponentModel.Container();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.ponents);
this.SuspendLayout();
this.label1.Location = new System.Drawing.Point(16, 40);
this.label1.Name = &label1&;
this.label1.Size = new System.Drawing.Size(112, 24);
this.label1.TabIndex = 0;
this.label1.Text = &00:00:00.00&;
// button1
this.button1.Location = new System.Drawing.Point(160, 40);
this.button1.Name = &button1&;
this.button1.TabIndex = 1;
this.button1.Text = &启动&;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.timer1.Interval = 50;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.AcceptButton = this.button1;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Name = &Form1&;
this.Text = &Form1&;
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
#endregion
/// &summary&
/// 应用程序的主入口点。
/// &/summary&
[STAThread]
static void Main()
Application.Run(new Form1());
private void Form1_Load(object sender, System.EventArgs e)
// 读取日志文件,初始化 cnt 计数器
// 读取日志文件,并使用操作系统默认的编码方案
System.IO.StreamReader sr = new System.IO.StreamReader(FileName, System.Text.Encoding.Default);
string line = sr.ReadToEnd();
sr.Close();
// 使用正则对像,分析日志,解析已经启动计时器的次数。
System.Text.RegularExpressions.MatchCollection matches = System.Text.RegularExpressions.Regex.Matches(line, &第\\s*(\\d+)&);
if(matches.Count & 0)
t = int.Parse(matches[matches.Count - 1].Groups[1].Value);
private void button1_Click(object sender, System.EventArgs e)
if(this.isStart) // 停止计时
this.timer1.Enabled =
this.timer1_Tick(this.timer1, e); // 停止计时后,最后一次计算时间,以保证计时正确(计时器设定为 50ms)。
System.IO.StreamWriter sw = new System.IO.StreamWriter(FileName, true, System.Text.Encoding.Default);
// 可以事先把字符串连接起来,再执行 Write 方法,但这样可以避免字符串连接运算(大文本时效率较高)。
sw.Write(&第 &);
sw.Write((++t).ToString());
sw.Write(& 次计时:&);
sw.Write(this.label1.Text);
sw.Write(&\r\n&);
sw.Close();
//this.label1.Text = &00:00:00.00&;
this.button1.Text = &启动&;
// 开始计时
this.beginTime = DateTime.N
this.timer1.Enabled =
this.button1.Text = &停止&;
this.isStart = !this.isS
private void timer1_Tick(object sender, System.EventArgs e)
TimeSpan ts = DateTime.Now - this.beginT // 使用当前时间减去启动时记录的时间
this.label1.Text = ts.Hours.ToString(&d2&) + &:& + ts.Minutes.ToString(&d2&) + &:& + ts.Seconds.ToString(&d2&) + &.& + ts.Milliseconds.ToString(&d2&);
提问者评价
感谢~~问下,保存记录的文本文件是放在那里的呢
其他类似问题
计时器的相关知识
按默认排序
其他1条回答
Timer 控件
您可能关注的推广回答者:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 linux socket头文件 的文章

 

随机推荐