网站大量收购闲置独家精品文档,联系QQ:2885784924

TCP高性能代码..doc

  1. 1、本文档共47页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
TCP高性能代码.

.?[代码]Program.cs???? 跳至 [2] [3] [全屏预览] view source print? 01 class Program 02 { 03 ????//This variable determines the number of 04 ????//SocketAsyncEventArg objects put in the pool of objects for receive/send. 05 ????//The value of this variable also affects the Semaphore. 06 ????//This app uses a Semaphore to ensure that the max # of connections 07 ????//value does not get exceeded. 08 ????//Max # of connections to a socket can be limited by the Windows Operating System 09 ????//also. 10 ????public const Int32 maxNumberOfConnections = 3000; 11 ?? 12 ????//If this port # will not work for you, its okay to change it. 13 ????public const Int32 port = 4444; 14 ?? 15 ????//You would want a buffer size larger than 25 probably, unless you know the 16 ????//data will almost always be less than 25. It is just 25 in our test app. 17 ????public const Int32 testBufferSize = 25; 18 ?? 19 ????//This is the maximum number of asynchronous accept operations that can be 20 ????//posted simultaneously. This determines the size of the pool of 21 ????//SocketAsyncEventArgs objects that do accept operations. Note that this 22 ????//is NOT the same as the maximum # of connections. 23 ????public const Int32 maxSimultaneousAcceptOps = 10; 24 ?? 25 ????//The size of the queue of incoming connections for the listen socket. 26 ????public const Int32 backlog = 100; 27 ?? 28 ????//For the BufferManager 29 ????public const Int32 opsToPreAlloc = 2;??? // 1 for receive, 1 for send 30 ?? 31 ????//allows excess SAEA objects in pool. 32 ????public const Int32 excessSaeaObjectsInPool = 1; 33 ?? 34 ????//This number must be the same as the value on the client. 35 ????//Tells what size the message prefix will be. Dont change this unless 36 ????//you change the code, because 4 is the length of 32 bit integer, which 37 ????//is what we are using as prefix. 38 ????public const Int32 receivePrefixLength = 4; 39 ????p

文档评论(0)

gangshou + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档