MFC在现有客户端服务器应用程序中添加新客户端 [英] MFC adding new client in the already existing client server application

查看:94
本文介绍了MFC在现有客户端服务器应用程序中添加新客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在不同系统中有2个外部应用程序,它们连接到每个应用程序并在端口4806上共享数据(发送,接收)。



系统A IP地址:234.30.XX

系统B IP地址:192.168.XX



系统B每次在端口4806上向系统A发送消息3秒(我还活着消息)



现在,我必须在System C上创建另一个应用程序并开始监视系统A IP地址端口4806上的消息。



1.我怎么能这样做?如何为现有客户端添加另一个应用程序 - 服务器?

2.如何监视系统A端口4806上发送的消息。因为系统B不向我的系统C发送任何消息,因为它不知道系统C是什么。

3.系统C上的应用程序应该连续监视系统B 4806端口上的我还活着消息。



请指导。



我尝试过:



尝试使用MFC CAsyncSocket类,但很少混淆如何处理通信。

I have 2 external applications in different systems, and they are connected to each and share the data (send, receive) on port 4806.

System A IP address: 234.30.X.X
System B IP address: 192.168.X.X

System B send the message to System A on port 4806 for every 3 seconds(I am alive messages)

Now, i have to create another application on System C and starts monitoring for the messages coming on System A IP address Port 4806.

1. How can i do that ? how to add another application for the already existing client - server ?
2. How to monitor for the messages going on System A port 4806. Because the System B does not send any messages to My system C, as it not aware of what System C is all about.
3. Application on System C should continously monitor the "i am alive" messages on System B 4806 port.

please guide.

What I have tried:

tried using MFC CAsyncSocket class, but little confused how to handle the communication.

推荐答案

看起来你必须创建一个代理,参见代理服务器 - 维基百科 [ ^ ]。

另请参阅: Google:tcp proxy C ++ [ ^ ]。
It looks you have to create a proxy, see Proxy server - Wikipedia[^].
See also: Google: "tcp proxy C++"[^].


这是一个相当不常见的拓扑结构,如果系统处于不同的网段,就像你的IP地址所示,如果没有修改至少一个现有的应用程序,可能无法解决。



来自我的您只有以下选择:

That is a rather uncommon topology and might be not solvable without modifying at least one of the existing applications when the systems are in different network segments as your IP addresses indicate.

From my point of view you have only these choices:


  1. 让系统A也发送给C

  2. 让系统B在接收数据包时发送给C

  3. 让系统C成为网络嗅探器。这要求将其放置在看到消息的网段中(例如,与系统A或B相同的段,并确保它接收数据,因为交换机可能只传递连接系统的数据包)

  4. 广播活动包。仅适用于配置路由器以使这些特定包通过的相同网段或本地网络。


这篇关于MFC在现有客户端服务器应用程序中添加新客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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