SocketServer设计 [英] SocketServer design

查看:65
本文介绍了SocketServer设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个接受大约100个连接的套接字服务器,但

这可能会增加到1000或更多的时间。数据吞吐量将是最小的,大多数是短随机爆发,但重要的是那些

连接保持活跃状态​​。


谷歌搜索了一下,我知道在.NET中有64个插槽

连接的限制?你是如何克服的?我应该为每个连接创建一个

的新线程吗?鉴于

少量数据,这看起来有点浪费。 (在2分钟的爆发中只有30个字节)。


Stuart。

I need to write a socket server that accepts around 100 connections, but
this could grow to a 1000, or more in time. The data throughput will be
minimal, mostly in short random bursts, but it''s important those
connections stay active.

Having googled a bit, I understand there is a limit of 64 socket
connections in .NET? How do you overcome that? Should I be creating a
new Thread for every connection? It seems a bit wasteful, given the
small amounts of data. (as little as 30 bytes in a 2 minute burst).

Stuart.

推荐答案

Stuart< ; ST **** @ stu.org.uk>在新闻中写道:37 ************* @ individual.net:
Stuart <st****@stu.org.uk> wrote in news:37*************@individual.net:
谷歌搜索了一下,据我所知有64个插座连接的限制在.NET?你是如何克服的?我应该创建一个

http://www.indyproject.org/ - 免费提供来源。

每个连接的新线程?鉴于
少量数据,这看起来有点浪费。 (在2分钟的爆发中只有30个字节)。
Having googled a bit, I understand there is a limit of 64 socket
connections in .NET? How do you overcome that? Should I be creating a
http://www.indyproject.org/ - Free with source.
new Thread for every connection? It seems a bit wasteful, given the
small amounts of data. (as little as 30 bytes in a 2 minute burst).




取决于。你可以使用UDP还是必须是TCP?

-

Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/

编程是一种反击的艺术形式 ;


让你的ASP.NET应用程序运行得更快
http://www.atozed.com/IntraWeb/


>>谷歌搜索了一下,我知道有一个限制在64位套接字
>>Having googled a bit, I understand there is a limit of 64 socket
.NET中的连接?你是如何克服的?我应该创建一个
connections in .NET? How do you overcome that? Should I be creating a


http://www.indyproject.org/ - 免费提供资源。


http://www.indyproject.org/ - Free with source.




看起来很有趣 - 谢谢。如果可能的话,我想避免使用第三方库

,因为我可能会稍后将其移植到Linux / Mono上。

值得一看。



Looks interesting - Thanks. I would like to avoid a 3rd party library
if possible, as I may look at porting this over to Linux/Mono later.
Worth a look though.

每个连接的新线程?鉴于
少量数据,这看起来有点浪费。 (在2分钟的爆发中只有30个字节)。
new Thread for every connection? It seems a bit wasteful, given the
small amounts of data. (as little as 30 bytes in a 2 minute burst).



取决于。你能使用UDP还是必须是TCP?


Depends. Can you use UDP or must it be TCP?




必须是TCP。我正在为已经存在

的客户编写网关/代理服务器。


S.



Has to be TCP. I''m writing a gateway/proxy server for clients that
already exist.

S.


Stuart< st **** @ stu.org.uk>在新闻中写道:37 ************* @ individual.net:
Stuart <st****@stu.org.uk> wrote in news:37*************@individual.net:
看起来很有趣 - 谢谢。如果可能的话,我想避免使用第三方库,因为我可能会稍后将其移植到Linux / Mono上。
值得一看。
Looks interesting - Thanks. I would like to avoid a 3rd party library
if possible, as I may look at porting this over to Linux/Mono later.
Worth a look though.



免费 - 并且有来源。 .NET可用,但非常有限:
http:// www .indyproject.org / Features.iwp

取决于。你能使用UDP还是必须是TCP?
Depends. Can you use UDP or must it be TCP?



必须是TCP。我正在为已经存在的客户编写网关/代理服务器。



Has to be TCP. I''m writing a gateway/proxy server for clients that
already exist.




一旦你达到大约1,000,线程肯定会成为一个问题。 99%

的服务器应该是线程化的,但在你的情况下,如果它只是在做小数据传递而不是很多,那么问题就在于1%



会话逻辑。

-

Chad Z. Hower(又名Kudzu) - http://www.hower.org/Kudzu/

编程是一种打架的艺术形式返回


在更短的时间内更轻松地开发ASP.NET应用程序:
http://www.atozed.com/IntraWeb/


这篇关于SocketServer设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆