简体   繁体   English

运行多个控制端口的服务

[英]Run multiple services which control port

I have a windows service which listens for TCP messages, responses to them and then saves information to a database. 我有一个Windows服务,该服务侦听TCP消息,对其进行响应,然后将信息保存到数据库中。 Overall the CPU and memory usage is relatively small. 总体而言,CPU和内存使用量相对较小。

I would like to run multiple of these on a single machine however the problem is that the only way I know which service is by the destination IP. 我想在一台机器上运行多个服务,但是问题是,我知道哪种服务的唯一途径是目标IP。 Thus is it possible for multiple to run on a single machine? 因此,有可能在单个计算机上运行多个文件吗?

Update: I need them to all run on the same port. 更新:我需要它们全部在同一端口上运行。 Thus service1 and service2 both listen on port X. A message intended for service1 must not go to service2. 这样,service1和service2都在端口X上侦听。发给service1的消息一定不能进入service2。 The messages themselves are indistinguishable. 消息本身是无法区分的。 The only way the message knows it is going to service1 is the destination ip. 消息知道到达service1的唯一方法是目标ip。

I guess port was originally designed to be some type of “service ID”, if this is completely inappropriate, you should consider additional logic inside your service for load balancing. 我想端口最初设计为某种“服务ID”,如果这完全不合适,则应考虑服务内部的其他逻辑以实现负载平衡。 Or something else... 或者是其他东西...

Can two applications listen to the same port? 两个应用程序可以侦听同一端口吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Windows服务不会运行多个服务 - Windows service that won't run multiple services 如何在多个浏览器中运行 ActiveX 控件 - how to run ActiveX control in multiple browsers 如何控制EF Core运行自定义迁移的顺序? - How to control which order the EF Core run custom migrations? 我如何在运行时知道哪个控件在前面? - How can I tell at run-time which control is in front? 为什么 nunit 不运行包含控制/特殊字符的测试 - Why does nunit not run a test which contains control/special chars 在同一端口问题上使用netTcp协议在WAS IIS中托管的多个WCF服务 - multiple WCF services hosted in WAS IIS using netTcp protocols on same port issue 如何判断哪个控件访问了具有多个引用的方法? - How to tell which control accessed a method with multiple references? 我可以在C#中运行多个控件但是相同的方法 - Can I run multiple control but same method in C# VSTO Word内容控件-在运行时添加多个RichTextContentControls - VSTO Word Content Control - adding multiple RichTextContentControls at run time .NET体系结构问题:2 Web服务,如何更改运行时使用的服务? - .NET Architectural issue: 2 Web Services, how do I change which one is used at run time?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM