与 ActiveX EXE 的套接字通信
我正在开发 ActiveX EXE 上的套接字读取(即在单独的线程上)。
我可以安全地独立读取多少个套接字?
我正在使用 Windows XP 操作系统。
I am developing socket reading on an ActiveX EXE (i.e on a seperate thread).
How many sockets i can safely read independently?
I am working on windows XP OS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这可能是操作系统的限制 - 我想我记得几年前在我使用的 XP 机器上遇到过 80 个套接字的限制。
I think this might be an operating system limit - I think I remember running up against a limit of 80 sockets on the XP machine I was using several years ago.
我建议您放弃您的努力并采用商业解决方案。我记得早在 90 年代就曾沿着这条路走下去,就线程而言,我遇到了 ActiveX EXE 的一堵砖墙。问题是 ActiveX EXE 是单元线程的,而不是自由线程的,因此您无法获得完全独立的线程。
在现代语言中正确地执行服务器端线程已经足够困难了,更不用说那些不是为此目的而设计的语言了。
我最终从 Dart 购买了服务器套接字。很容易成为该项目的最佳投资。性能确实很棒 - 您只受系统资源的限制。
I would recommend that you abandon your effort and go with a commercial solution. I remember going down this path back in the 90s and running into a brick wall with ActiveX EXEs as far as threading goes. The thing is that ActiveX EXEs are apartment threaded, not free-threaded, so you don't get completely independent threads.
And doing server side threads properly is hard enough in modern languages, let alone ones that weren't designed for this purpose.
I ended up purchasing Server Sockets from Dart. Easily the best investment for that project. The performance is truly great - you are only limited by the system resources.
MSWINSCK.OCX 是一种非常古老的做事方式;它随 Visual Basic 6.0 一起提供,我记得很久以前就使用过它。我不确定它的许可...显然它在 32 位 win7 下注册得很好,但在 64 位下不行;以下是如何让它在 64 位系统上注册的链接:http://angrybyte.com/windows-hacks/mswinsck-ocx-for-64-bit-windows-7-vista/
如果您有MSDN 订阅或类似的使您能够下载开发人员工具(bizSpark 等也可以),那么我相信这也会为您提供重新分发 .ocx 的许可证。
(顺便说一句,我实际上不记得该接口,但我似乎记得它至少比 berkeley socket() 接口更直观。)
但是,根据您的要求,个人建议:学习 API,有很多示例在那里,只需编写一个类,以类似于 .NET Socket 类的方式封装它们...API 并不那么难,我相信这里也有很多帮助,这可能比依赖于像控件这样过时的东西......
MSWINSCK.OCX is a very old way of doing things; it came with Visual Basic 6.0 and i remember using it way back when. i'm not sure the licensing on it... apparently it registers fine under 32-bit win7, but not 64-bit; here's a link to how to get it to register on 64-bit systems: http://angrybyte.com/windows-hacks/mswinsck-ocx-for-64-bit-windows-7-vista/
if you have an MSDN subscription or similar that gives you the ability to download the developer tools (bizSpark, etc. will do it too) then i believe that will also give you a license to redistribute the .ocx.
(btw, i don't actually remember the interface, but i seem to remember it being at least slightly more intuitive than the berkeley socket() interfaces.)
however, personal recommendation given your requirements: learn the APIs, there are lots of examples out there, and just write yourself a class that encapsulates them in a similar way as, say, the .NET Socket class... the APIs aren't that hard and i'm sure there's lots of help to be had here as well, and that's probably better than relying on something that's out-of-date like the control...