请不要说在网上查找.我没有找到.: (

解决方案 »

  1.   

    可我还是说要网上找哪,google,,如果连这个东西都找不到:(
    看样子你还不会使用搜索http://www.google.com/search?hl=zh-CN&q=asp.net+%E8%81%8A%E5%A4%A9%E5%AE%A4%E6%BA%90%E7%A0%81&lr=
      

  2.   

    try UDPusing System;
    using System.Net;
    using System.Net.Sockets;
    using System.Text;
    using System.Threading;namespace UdpServer
    {
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    class Char
    {
    private static IPAddress remoteIPAddress;
    private static int remotePort;
    private static int localPort;
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    try
    {
    //Get necessary data for connection
    Console.WriteLine("Enter Local port");
    localPort =  Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter remote port");
    remotePort = Convert.ToInt16(Console.ReadLine()); Console.WriteLine("Enter remote IP Address");
    remoteIPAddress = IPAddress.Parse(Console.ReadLine()); //Create thread for listening
    Thread tRec = new Thread(new ThreadStart(Receiver));
    tRec.Start(); while(true)
    {
    Send(Console.ReadLine());
    }
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.ToString());
    }
    } private static void Send(string datagram)
    {
    //Create UdpClient
    UdpClient sender = new UdpClient(); //Create IPEndPoint with detail of remote host
    IPEndPoint endPoint = new IPEndPoint(remoteIPAddress,remotePort); try
    {
    byte[] bytes = Encoding.ASCII.GetBytes(datagram);
    sender.Send(bytes,bytes.Length,endPoint);
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.ToString());
    }
    finally
    {
    sender.Close();
    }
    } private static void Receiver()
    {
    //Create a UdpClient for reading incoming data.
    UdpClient receivingUdpClient = new UdpClient(localPort); //IPEndPoint with remote host information
    IPEndPoint RemoteIPEndPoint = null; try
    {
    Console.WriteLine("---------------*********Ready for char!!!!*******------------");
    while(true)
    {
    //wait for datagram
    byte[] receiveBytes = receivingUdpClient.Receive(ref RemoteIPEndPoint); //Convert and display data
    string returndata = Encoding.ASCII.GetString(receiveBytes);
    Console.WriteLine("-"+returndata.ToString());
    }
    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.ToString());
    }
    }
    }
    }
      

  3.   

    网上的确有几个,但都没有源码,都是编译过的
    那位大侠有的话麻烦也发给俺一份
    [email protected]