[TAG] Problem in Client when spawning multiple connections on socket

Mulyadi Santosa mulyadi.santosa at gmail.com
Thu Jan 18 09:36:37 MSK 2007


Dear Amit Saha
> Hi list!
> i need your advice. The situation is like this
>
>   
let me try my luck...
> We have a situation where we have a DEC Alpha Server with a Concurrent
> Server which spawns a child to every process that we connect to. On a
> Linux box on the same network, we have built a client which connects
> to the server ,we see the connection and every things is good. At this
> time we try to invoke another instance of the this client, at this
> point it kills the first connection and the second one connects. We
> are passing the Internet address of the server to connect.
>
>   

OK, I am stressing to one fact here. Anytime another instance of client 
tries to connect to the DEC Server, the server will kill the previous 
established connection? Do I conclude it correctly?
> If we have the client on the same server we can spawn multiple
> instances and every instance connects, in this case though the address
> 127.0.0.1 or the local host.
>
>   
OK, another point here is, if the connection is made within the same 
server (so the server also acts as the client), everything will run fine 
even though you spawn many instance of clients?

> Any pointers as to how we can have multiple client using the same socket.
>   
I have untested idea. Fork() new instance of clients but make the socket 
descriptor a shared property between those instance. Then, do somekind 
of coordination between these forked clients so whenever one client 
writes, the other waits until it finishes. The same applies on reading 
case, maybe use select() and observe the incoming data to decide which 
client is in charge with the received data.

All in all, in this multiplexing situation, you surely need a tag or 
something to mark the packet destination, I mean to distinguish the real 
acceptor of the packet. IMHO you must do this since the clients use the 
same socket, that means same local port, same socket descriptor and so on.

I hope you do get my explanation correctly. If not, just ask again....

regards,

Mulyadi






More information about the TAG mailing list