I wrote a c# app that listens to port 8000 and 8001.
我写了一个听取端口8000和8001的c#app。
There are two different applications that connects to 8000 and 8001. I have used socket arrays so that any number of connections are accepted.
有两个不同的应用程序连接到8000和8001.我使用了套接字阵列,以便接受任意数量的连接。
Will I be able to some how attach one 8000 connection and 8001 connection in such a way that what ever data send by the application connected at 8000 will be received by the app at 8001 and vise versa. What is this concept known as ? sorry if this is a very basic question.
我是否能够以某种方式连接一个8000连接和8001连接,以便应用程序在8001接收由8000连接的应用程序发送的数据,反之亦然。这个概念叫做什么?对不起,如果这是一个非常基本的问题。
2 个解决方案
#1
That sounds quite a bit like a proxy or a tunneler.
这听起来有点像代理或隧道。
http://en.wikipedia.org/wiki/Proxy_server
In which case, yes this is entirely possible.
在这种情况下,是的,这是完全可能的。
Though, if you're allowing multiple connections on both ports how will you know which connection goes with which? Say there are connections A, B and C on 8000 and X, Y and Z on 8001. Does the data from A go to Y and visa versa or does the data from B go to Y and visa versa?
但是,如果您在两个端口上允许多个连接,您将如何知道哪个连接与哪个连接?假设在8000上有连接A,B和C,在8001上有X,Y和Z.来自A的数据是否转到Y,反之亦然,或者B的数据是否转到Y,反之亦然?
#2
In Java there are PipedInputStream and PipedOutputStream. Maybe the C# library offers something similar?
在Java中有PipedInputStream和PipedOutputStream。也许C#库提供类似的东西?
#1
That sounds quite a bit like a proxy or a tunneler.
这听起来有点像代理或隧道。
http://en.wikipedia.org/wiki/Proxy_server
In which case, yes this is entirely possible.
在这种情况下,是的,这是完全可能的。
Though, if you're allowing multiple connections on both ports how will you know which connection goes with which? Say there are connections A, B and C on 8000 and X, Y and Z on 8001. Does the data from A go to Y and visa versa or does the data from B go to Y and visa versa?
但是,如果您在两个端口上允许多个连接,您将如何知道哪个连接与哪个连接?假设在8000上有连接A,B和C,在8001上有X,Y和Z.来自A的数据是否转到Y,反之亦然,或者B的数据是否转到Y,反之亦然?
#2
In Java there are PipedInputStream and PipedOutputStream. Maybe the C# library offers something similar?
在Java中有PipedInputStream和PipedOutputStream。也许C#库提供类似的东西?