TCP/IP software multiplexer

Hi,

I need to build what I call a multiplexer. The purpose is to be able to get multiple input sockets directed through a single output socket. My strategy is to do the following.
On demand I establish a new input socket in an array, make a connection to the output socket and send data through it. Now, I will be receiving data back on the output socket. Since there will be several input sockets, is there a way to identify the input socket who sent that data. Also, since I will receiving multiple returns on the output socket, is there a way to prevent possible data loss by receiving them at the same time.
I will be using VB6, but VB .NET could be used also.

Regards,
lxfdirsAsked:
Who is Participating?
 
skullnobrainsCommented:
--> which answer corresponds to which input socket ?
either the protocol which you are proxying supports multiplexing of commands, in which case you can rewrite the ids sent by the client and map the return ids to the proper client, or it does not in which case there is no way to do this and you have to queue the client queries

--> data loss
there should be no such problem over TCP and you'd rather focus on timeouts. setting tcp keep-alive client-side should help when lots of queries are queued. using an outgoing connection pool is obviously better than a single one.

if you use a select or equivalent call or event programming, you will strongly minimise the risk since you never wait on a specific socket without listening to the others. during each of the program's loops, all the sockets that hold data yet to be read at the beginning of the loop will be read from during the loop, and the loop should be very fast if your proxy only acts as a multiplexer.

reading "at the same time" is meaningless since reading from the socket means to read from a file descriptor, so the data comes in sequentially and not "at the same time"
0
 
TimotiStDatacenter TechnicianCommented:
I don't think you can 'hide' any marking in the IP or TCP header you send out, so unless you can work with the contents of the TCP segment, I don't think it's easily possible.
0
 
Jaime OlivaresSoftware ArchitectCommented:
yes, you can identify who sent the data at your multiplexer's listener, but once you forward it, you will lose that information. So the final application won't know who to send it back but to the multiplexer.
To overcome this situation, you would have to wrap the original message along with the extra info of the sender.
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
lxfdirsAuthor Commented:
Hi, guys:

Appreciate your responses. I am taking them into consideration. Now, do you have some recommendation on the last part of the question --- Also, since I will receiving multiple returns on the output socket, is there a way to prevent possible data loss by receiving them at the same time.---. Will winsock as example, buffers the packets or handshakes with the sender to prevent data loss?

Regards,
0
 
Jaime OlivaresSoftware ArchitectCommented:
Are you using TCP or UDP? TCP shouldn't lose packets.
A well known limitation is present in Windows desktop OSs. They will allow a short number of connections in parallel. For unlimited connections you need to use a server OS.
0
 
lxfdirsAuthor Commented:
I am using TCP and application will run in Windows Server 2008.

Regards,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.