Which tool can be used to connect two TCP/IP servers?

1

2

The tool should connect to any two TCP/IP servers and transparently route sends and receives between them. The tool should connect to both the TCP/IP servers and transparently forward any data it receives between the two.

The problem that the tool is intended to solve is that there are two networked devices, each behaving as a server. One of the devices will send TCP/IP data to its client when an event occurs on it, then other expects this data to be sent to it.

Thomas Bratt

Posted 2009-09-14T13:43:32.360

Reputation: 803

Question was closed 2014-05-16T02:07:50.370

In what context? Depending on what program you are talking about, it could range any ware from "Impossible" to "Check 'client' under 'options'" – Grant – 2009-09-14T13:47:24.013

More info needed. What are you trying to accomplish? – Mark – 2009-09-14T13:56:49.203

Added some more description now. – Thomas Bratt – 2009-09-14T14:30:57.370

Usually, you need to connect two networked devices together by having one connect to the other. So the sender would open up a TCP/IP connection to the listener. Or the listener would open up a TCP/IP connection to the sender. – J. Polfer – 2009-09-14T15:57:50.137

1@sheepsimulator: this is true, but in this case I have two TCP/IP servers, both with a listening socket. Hence the problem! :) – Thomas Bratt – 2009-09-14T16:02:12.063

Can either of these two server programs be modified? – J. Polfer – 2009-09-14T16:11:52.143

@sheepsimulator: Unfortunately not. – Thomas Bratt – 2009-09-14T16:21:58.443

Are you running windows or Linux? – J. Polfer – 2009-09-14T16:22:57.710

Windows. I have updated the tags to indicate this. – Thomas Bratt – 2009-09-14T16:24:12.810

@Thomas Bratt - that sounds like an extremely sweet project. Best of luck at your trade show! – J. Polfer – 2009-09-15T13:55:38.370

Answers

4

NOTE: Answer is completely revised based upon clarifications.

OP has two servers, both listening. One sends out data, the other is waiting for it to come in. But they are both listeners, and require a TCP/IP client to connect to both of them at the same time.

You need, essentially, a pipe program, that connects to both of the servers at the same time, and whatever is sent out of one server should be sent to the other.

Checkout the netcat program (Windows version available here). You might be able to do something like this:

nc <send svr> <send svr port> | nc <recv svr> <recv svr port>

J. Polfer

Posted 2009-09-14T13:43:32.360

Reputation: 2 234

Thanks for the tip and the link :) I really have two TCP/IP servers, each using a listening socket and waiting for an incoming connection. There is no 'sending server' (ie a client) in this setup. – Thomas Bratt – 2009-09-14T16:00:34.313

Excellent! I'll check it out :) – Thomas Bratt – 2009-09-14T16:37:12.630

@sheepsimulator, your mental powers are strong. I would have never guessed the meaning of this question :) – vava – 2009-09-14T22:06:13.947

1It works, thank you :)

Just to let you know - it will be used for a trade show in Stockholm next week, where it will forward motion-detection events to a server I wrote. Eventually we will write some software to connect as a client but we don't have time before the show. – Thomas Bratt – 2009-09-15T08:52:05.340

@vava - It was an iterative process. Check out my edit log, this answer has gone through 7 revisions. – J. Polfer – 2009-09-15T13:09:44.963

1

Servers running TCP/IP can already communicate freely, assuming they're on the same net. That's what TCP/IP does. You might need to hook up a router of some sort if they're on different nets. If that's your issue, you need to describe your problem more fully, because what might be good for connecting isolated nets might not be good for subnets using NAT with a single IP address.

By mentioning "server" and "client", you seem to be implying some sort of application that communicates with TCP. However, many programs have distinct client and server roles that are not interchangeable. A Subversion server will not check out a source tree, for example. There is no automatic translation, and can't be, since people keep writing new programs. If you have a specific application, or list, in mind, you could add that to your question.

David Thornley

Posted 2009-09-14T13:43:32.360

Reputation: 701

The problem is that I have two devices, each of which behaves like a TCP/IP server. One of them will generate some data when an event occurs and I would like to have this data automatically forwarded to the other server. – Thomas Bratt – 2009-09-14T15:30:52.350

0

Based on the revised text, "You need, essentially, a pipe program, that connects to both of the servers at the same time, and whatever is sent out of one socket should be put into the other.", this sounds to me like a load balancer. And for this, you might actually look at load balancing / failover hardware. And this kind of connection is best managed by hard-ware based devices.

jfmessier

Posted 2009-09-14T13:43:32.360

Reputation: 2 530

Can you find a practical example where that is/can be used in that way? Sounds like overkill. – J. Polfer – 2009-09-14T16:45:33.643

It all depends on how fast is your connection, and how critical it is. Cisco makes some of this hardware. However, you should be able to have a software-based solution, using Linux and a PC with three or more NICS to provide load balancing. For example, if you have a web site that you need to have load balancing/fail over, you can have the two web sites behind the load balancer, with some synchronizing tool for the content, and the load balancer in front of them, showing a single IP address. Where it becomes trickier, is managing connection-less sessions. – jfmessier – 2009-09-15T11:54:12.850