Greetings...

I have a large client-server application in production now.  My choice was
to use sockets for communication.  IPC turned out to be too slow and
troublesome for the volume of data.  Plus, I wanted to have the flexibility
of placing client processes on separate servers in the future (my client and
server parent processes are separate).  Each client connects to the server
and sends a command identifying itself (process ID).  The server checks the
client's hostname with $client->peerhost (peeraddr also works I believe).
Client requests the data and the server sends it back.  Once you have the
socket connection, just communicate back and forth.  Although it is costly
to "change direction" frequently.  In my case, my client sends all the data
the server needs then the server responds.  Close connection.

Client identification is up to you.  Use something that is unique.  I found
hostname + PID to work well.

As far as the server contacting the client - is that the best way?  Becomes
more of a server-server architecture then, I would think?  Client calls the
server, the server listens.  If the client is also listening then it becomes
the server.  A confusing duality to be sure.

The only way that I could think to manage this with sockets would be to have
each client bind to a different port and communicate that information to the
server at startup.  Server would then have to keep track of the info.
Personally, I do not think this is a good direction to follow at all.  You
can use signals to communicate from server to client, but you can not really
send useful information that way.

Hope that helps you,


Jeremy Elston 
Sr. Staff Unix System Administrator 
Electronic Brokerage Technology 
Charles Schwab & Co., Inc. 
(602.977.4413 [EMAIL PROTECTED]) 

"Are you still here?š What are you doing?š There is nothing left to
read.š The e-mailšis over.š Move on...š Go on -šget out of here.š SHOO!"


WARNING:š All email sent to this address will be received by the Charles
Schwab Corporate email system and is subject to archival and review by
someone other than the recipient



-----Original Message-----
From: Vadim K [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 01, 2001 1:34 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] (no subject)



 Dood day!
 I wrote a server which listens on a specific port and 
for each client splits child proccess (using fork()). 
I need to exchange between them (proccesses). I tried 
to use pipe (used socketpair function), but can create 
only one.   
 I have such a general question: How to organize 
interconnection between proccesses though server? How 
does server know which client sends data (proccess 
identification) and how can it send data to a cpecific 
client?
 Thank you.
 
P.S. Used IO::Socket

/Vadim/  
        mailto:[EMAIL PROTECTED]
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users


Reply via email to