?
Solved

TCP/IP software multiplexer

Posted on 2012-09-08
6
Medium Priority
?
604 Views
Last Modified: 2012-09-30
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,
0
Comment
Question by:lxfdirs
6 Comments
 
LVL 17

Expert Comment

by:TimotiSt
ID: 38379329
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
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 150 total points
ID: 38380520
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
 

Author Comment

by:lxfdirs
ID: 38380717
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 38380803
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
 

Author Comment

by:lxfdirs
ID: 38382598
I am using TCP and application will run in Windows Server 2008.

Regards,
0
 
LVL 27

Accepted Solution

by:
skullnobrains earned 1350 total points
ID: 38401780
--> 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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
In this article I will be showing you how to subnet the easiest way possible for IPv4 (Internet Protocol version 4). This article does not cover IPv6. Keep in mind that subnetting requires lots of practice and time.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question