0

My question is more general rather than specific. I want to implement a simple socket proxy server, where the server will receive requests from multiple clients, and forward it to another server using a single and unique connection, and the way back, the response comes to client.

The question is, can I keep a TCP connection open (maybe using ping?) and traffic the data inside it, so the final server will only count one connection? Like the example below.

client 1 - - -|        |  Single Con |
client 2 - - -| Proxy  |  -------->  |Destination
client 3 - - -| Server |  <--------  |Server
client 4 - - -|        |             |

Any suggestion or example?

1 Answer 1

1

If multiple client connections can be shared within the same TCP connection fully depends on the application protocol. There is nothing in TCP itself which prevents it but there is nothing in TCP which explicitly supports it either. One would need to be implement the distinction between the different client streams (i.e. originally client connections) through some multiplexing at the application layer and the destination server must support this, i.e. must be able to demultiplex it again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.