資源簡介
一次.net Socket UDP編程的10萬客戶端測試記錄.包含客戶端和服務器端,需要注意的是客戶端里由于電腦端口問題,測試最好分多臺電腦。
http://www.cnblogs.com/keyindex/archive/2010/12/15/1901875.html

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading;
namespace?SocketUdpClient
{
????class?Program
????{
????????static?string?serverIp;
????????static?string?name?=?string.Empty;
????????static?int?port1port2;
????????static?UdpClient?client;
????????static?void?Main(string[]?args)
????????{
????????????Console.WriteLine(“輸入服務器IP地址“);
????????????serverIp?=?Console.ReadLine();
????????????Console.WriteLine(“輸入接入端口“);
????????????port1?=?int.Parse(Console.ReadLine());
????????????Console.WriteLine(“輸入通信端口“);
????????????port2?=?int.Parse(Console.ReadLine());
????????????while?(running())?;
????????????Console.ReadKey();
????????}
????????static?bool?running()
????????{
????????????int?txtNum;
????????????Console.WriteLine(“輸入最大連接數“);
????????????txtNum?=?int.Parse(Console.ReadLine());
????????????client?=?new?UdpClient(port1?port2?serverIp?txtNum);
????????????for?(int?i?=?0;?i?????????????{
????????????????client.Start();
??????????????
????????????????Thread.Sleep(30);
????????????}
????????????return?txtNum?>?0;
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????6846??2010-12-13?16:06??SocketUdpClient\bin\Debug\Debug.rar
?????文件???????7168??2010-12-23?09:53??SocketUdpClient\bin\Debug\SocketUdpClient.exe
?????文件??????15872??2010-12-23?09:53??SocketUdpClient\bin\Debug\SocketUdpClient.pdb
?????文件??????14328??2010-12-23?09:52??SocketUdpClient\bin\Debug\SocketUdpClient.vshost.exe
?????文件????????490??2009-06-11?05:14??SocketUdpClient\bin\Debug\SocketUdpClient.vshost.exe.manifest
?????文件???????8704??2010-12-23?09:53??SocketUdpClient\bin\Debug\SocketUdpCore.dll
?????文件??????24064??2010-12-23?09:53??SocketUdpClient\bin\Debug\SocketUdpCore.pdb
?????文件???????3296??2010-12-23?09:53??SocketUdpClient\obj\Debug\ResolveAssemblyReference.cache
?????文件????????896??2010-12-23?09:53??SocketUdpClient\obj\Debug\SocketUdpClient.csproj.FileListAbsolute.txt
?????文件???????7168??2010-12-23?09:53??SocketUdpClient\obj\Debug\SocketUdpClient.exe
?????文件??????15872??2010-12-23?09:53??SocketUdpClient\obj\Debug\SocketUdpClient.pdb
?????文件???????1232??2010-12-13?15:29??SocketUdpClient\Program.cs
?????文件???????1374??2010-12-09?09:36??SocketUdpClient\Properties\AssemblyInfo.cs
?????文件???????2770??2010-12-09?14:11??SocketUdpClient\SocketUdpClient.csproj
?????文件???????3082??2010-12-13?16:24??SocketUdpClient\UdpClient.cs
?????文件???????8704??2010-12-23?09:53??SocketUdpCore\bin\Debug\SocketUdpCore.dll
?????文件??????24064??2010-12-23?09:53??SocketUdpCore\bin\Debug\SocketUdpCore.pdb
?????文件???????2574??2010-12-13?11:35??SocketUdpCore\BufferManager.cs
?????文件???????5120??2010-12-21?10:41??SocketUdpCore\obj\Debug\Refactor\SocketUdpCore.dll
?????文件????????628??2010-12-23?09:53??SocketUdpCore\obj\Debug\SocketUdpCore.csproj.FileListAbsolute.txt
?????文件???????8704??2010-12-23?09:53??SocketUdpCore\obj\Debug\SocketUdpCore.dll
?????文件??????24064??2010-12-23?09:53??SocketUdpCore\obj\Debug\SocketUdpCore.pdb
?????文件???????1370??2010-12-09?09:35??SocketUdpCore\Properties\AssemblyInfo.cs
?????文件???????1624??2010-12-13?11:00??SocketUdpCore\SocketAsyncEventArgsPool.cs
?????文件???????2655??2010-12-13?11:41??SocketUdpCore\SocketUdpCore.csproj
?????文件???????2733??2010-12-14?16:00??SocketUdpCore\UdpReceiveSocket.cs
?????文件???????3789??2010-12-21?10:57??SocketUdpCore\UdpSendSocket.cs
?????文件???????8704??2010-12-23?09:53??SocketUdpServer\bin\Debug\SocketUdpCore.dll
?????文件??????24064??2010-12-23?09:53??SocketUdpServer\bin\Debug\SocketUdpCore.pdb
?????文件???????7680??2010-12-23?09:53??SocketUdpServer\bin\Debug\SocketUdpServer.exe
............此處省略38個文件信息
評論
共有 條評論