100分求网络聊天源码用socket的
简单的实现就行,主要想了解服务器和客户端如何通过一个连接,发送和接收信息(异步\C#)
我的E_mail:misng@163.com
谢谢各位大侠了..
------解决方案--------------------
这个通讯聊天的客户端!
using System;
using System.Net.Sockets;
using System.Text;
public class TcpTimeClient
{
   private const int portNum = 1555;
   private const string hostName = "localhost";
   public static int Main(String[] args)
   {
       while (true)
       {
           try
           {
               Console.Write("Try to connect to " + hostName + ":" + portNum.ToString() + "\r\n");  
               TcpClient client = new TcpClient(hostName, portNum);
               while (true)
               {
                   NetworkStream ns = client.GetStream();
                   byte[] bytes = new byte[1024];
                   int bytesRead = ns.Read(bytes, 0, bytes.Length);
                   Console.WriteLine(Encoding.ASCII.GetString(bytes, 0, bytesRead));
               }
               string message=Console.ReadLine();
               if (message == "stop")
               {
                   client.Close();
               }
           }
           catch (Exception e)
           {
               Console.WriteLine(e.ToString());
               Console.ReadLine();
           }
           return 0;
       }
   }   
------解决方案--------------------C#做聊天程序建议使用Remoting
------解决方案--------------------我原来有一个的,一下忘记放那里了!
------解决方案--------------------学习
------解决方案--------------------up
------解决方案--------------------我有一个TCP 一个UTP的 不知道你要哪个
------解决方案--------------------学习一下