急求一个简单的asp.net聊天室源码。谢谢. 请不要说在网上查找.我没有找到.: ( 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可我还是说要网上找哪,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= 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()); } } }} 网上的确有几个,但都没有源码,都是编译过的那位大侠有的话麻烦也发给俺一份[email protected] wcf问题:超出最大名称表字符计数配额 (16384)。 求讲解 什么是二元参数?什么是一元参数...有没有高手知道? 如何指定repeater循环的次数,两个关联的表查询 我的广告链程序,大家支持下 在HTMLTable的单元格中插入TextBox,如何充满单元格 弱弱的问一下,微软vs.net2005,asp.net2.0正式版到底发布了没有? 问题得到解决,100分相送secondlife,感谢提醒了梦中人,呵呵 在ASP.NET页面这样的列表怎样实现,在线等待!!! 数据显示 DataGrid中的行问题 帮看一段,用户验证的代码
看样子你还不会使用搜索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=
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());
}
}
}
}
那位大侠有的话麻烦也发给俺一份
[email protected]