标题:一个聊天程序问题
取消只看楼主
c_23929427
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-22
 问题点数:0 回复次数:0 
一个聊天程序问题

写一个聊天的程序可是有点问题,帮忙看看
public void Listen()
{
try
{
TcpListener tcpl = new TcpListener(8080);
tcpl.Start();
toolStripStatusLabel1.Text = "正在监听。。。";
while (true)
{
Socket s = tcpl.AcceptSocket();//运行到这里就不动了

byte[] stream = new byte[80];
int i = s.Receive(stream);
string message = System.Text.Encoding.UTF8.GetString(stream);
richTextBox1.AppendText(message);

}
}
catch (System.Security.SecurityException)
{
MessageBox.Show("防火墙错误", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
catch(Exception)
{
toolStripStatusLabel1.Text = "停止监听";
}
}

谢谢拉!!!

搜索更多相关主题的帖子: tcpl TcpListener 聊天 new 
2006-08-04 16:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-82116-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024895 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved