Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 23-Nov-17 23:10pm

It looks you have to create a proxy, see Proxy server - Wikipedia[^].
See also: Google: "tcp proxy C++"[^].
 
Share this answer
 
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. Let system A also send to C
  2. Let system B send to C when receiving packets
  3. Let system C be a network sniffer. This requires that it is placed in a network segment that sees the messages (e.g. same segment as system A or B and ensuring that it receives the data because switches might pass only packets for connected systems)
  4. Broadcasting the alive packets. Will only work in the same network segment or local networks where routers are configured to let these specific packages pass.
 
Share this answer
 
Comments
Member 13059643 27-Nov-17 2:48am    
@Jochen, thank you for your comments, it certainly gave me some insights to the requirement. Updated with few corrections to my problem.

1. System A and B are in the same segment.
2. The System C (Newly added) will have 2 NIC cards (one to the same segment where A and B are in)

1. how should my application in the new system C will communicate with System B, using the NIC card IP address that is in the same segment as of system B.
2. How should my application receive the messages ("I am alive") on coming to System B from System C on port 4306.
Jochen Arndt 27-Nov-17 3:06am    
1. That can only be done as explained by my first two options (C is a listening server and A or B are clients connecting to C).
2. For the above like any listening TCP server. Or using my 3rd (sniffing) option which requires to put the NIC on C into promiscuous mode.

There is also a 3rd option:
- Let B send to C (no need to update the software on B if the destination system IP can be configured)
- Let C send to A (no need to update the software on A if the source of the packets does not care)

Then C contains similar code like A for receiving the packets and code like B for sending. It is then acting as "forwarder".
Member 13059643 29-Nov-17 6:41am    
Thank you So much @Jochen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900