Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Answer: Client Server Communication. How to accept data sent by the server?

( #6957=categorized answer: print w/ replies, xml ) Need Help??

Q&A > network programming > Client Server Communication. How to accept data sent by the server? contributed by btrott

Well, generally, the client writes the request to the server, then waits for a response from the server. So, in the client:
print $server "FOO request\n"; my $response = <$server>; # or my $bytes_read = read($server, $response, 4192); # or whatever--basically, just read from the server
And the server accepts connections, reads the requests, handles them, then sends back data:
my $client = $server->accept; my $request = <$client>; # do something with the request # generate a response print $client $response; close $client;
This is very dumbed-down, but it gets across the general idea, I think. Is that what you were asking?

Comment on Answer: Client Server Communication. How to accept data sent by the server?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-07-11 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls