MSAsyncSocketServer
所属分类:网络编程
开发工具:C#
文件大小:28KB
下载次数:26
上传日期:2011-07-26 10:48:55
上 传 者:
fightorqin
说明: 微软公司自己开发的,高效率的socket编程。很权威的简单例子。
(Microsoft' s own development, efficient socket programming. Very authoritative and simple example.)
文件列表:
AsyncSocketServer\cs\AsyncSocketClient\app.config (144, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketClient\AsyncSocketClient.csproj (4298, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketClient\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache (5442, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\Program.cs (5505, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketClient\Properties\AssemblyInfo.cs (1300, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\app.config (144, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketServer\AsyncSocketServer.csproj (4478, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketServer\AsyncUserToken.cs (646, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\bin\Debug\AsyncSocketServer.exe.config (144, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketServer\bin\Debug\AsyncSocketServer.vshost.exe (11592, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\bin\Debug\AsyncSocketServer.vshost.exe.config (144, 2009-11-06)
AsyncSocketServer\cs\AsyncSocketServer\bin\Debug\AsyncSocketServer.vshost.exe.manifest (490, 2009-08-31)
AsyncSocketServer\cs\AsyncSocketServer\BufferManager.cs (2569, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\obj\Debug\AsyncSocketServer.csproj.FileListAbsolute.txt (112, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache (5442, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\Program.cs (3395, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\Properties\AssemblyInfo.cs (1300, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\Server.cs (11404, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer\SocketAsyncEventArgPool.cs (1771, 2009-09-30)
AsyncSocketServer\cs\AsyncSocketServer.sln (1446, 2009-10-28)
AsyncSocketServer\cs\AsyncSocketServer.suo (22528, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\obj\Debug\TempPE (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\obj\Debug\TempPE (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\bin\Debug (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\obj\Debug (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\bin\Debug (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\obj\Debug (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\bin (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\obj (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient\Properties (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\bin (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\obj (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer\Properties (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketClient (0, 2011-07-25)
AsyncSocketServer\cs\AsyncSocketServer (0, 2011-07-25)
AsyncSocketServer\cs (0, 2011-07-25)
AsyncSocketServer (0, 2011-07-25)
Asynchronous Socket Server Sample
=================================
This sample demonstrates how to use the xxxAsync (xxx = receive, send, connect, etc) methods on the Sytem.Net.Sockets.Socket
class by implementing an echo server (ie. The server sends all the data read from a client back to the client).
The echo server implemented in this sample handles multiple clients simultaneously (up to a maximum specified as a command line argument)
and highlights some of the key elements of the event-based asynchronous socket methods.
The sample illustrates creating a pool of reusable data buffers and SocketAsyncEventArgs context objects as a method to
increase server performance.
The sample is intended for educational purposes and should not be used directly in production applications.
Sample Language Implementations
===============================
This sample is available in the following language implementations:
C#
Prerequisites
=============
This sample requires the .NET Framework v4.0
Building the Sample
===================
To build the sample using Visual Studio (preferred method):
1. Double-click the AsyncSocketServer.sln file to open the socket server sample in Visual Studio.
2. Using the menu, click Build > Build Solution.
To build the sample using the command prompt:
1. Open the Command Prompt window and navigate to the directory containing the socket server sample.
2. Type msbuild AsyncSocketServer.sln.
Running the Sample
==================
The socket server requires four command line parameters.
Usage:
AsyncSocketServer.exe <#connections>
# Connections: The maximum number of connections the server will accept simultaneously.
Receive Size in Bytes: The buffer size used by the server for each receive operation.
Address family: The address family of the socket the server will use to listen for incoming connections. Supported values are ‘ipv4’ and ‘ipv6’.
Local Port Number: The port to which the server will bind.
Example:
AsyncSocketServer.exe 500 1024 ipv4 8000
近期下载者:
相关文件:
收藏者: