I happened to be working on a TCP/IP server when this hit my desk
and having Programming Perl open to the correct page, thought I might as
well quote the "select..." line from the client code...
select ((select(Server), $| = 1)[0]; print Server "Howdy\n"; $answer = <Server>;
from p 440 of the 3rd edition. Hope that helps, I've done servers lots more than clients...
select() unfortunately serves two not-well-related roles. This isn't the one I was speaking of, though it could indeed prove usefully in server programming.
I was speaking of using the four argument version of select() to poll sockets you are waiting on. Others have shown that this isn't a must in every case, but the main trick of network programming is usually, doing multiple thinks at once. Simply reading and writing is two actions, so it can be done at the same time and that's if we're only talking about one connection. The server itself may also need to take regular actions. That's where select()ing over non-blocking sockets, fork()ing or threading come in, generally.
If your needs are simple enough, it's hard to beat the line oriented routines for ease of use. If you need to do multiple things at once though, sysread() probably isn't going to do it alone.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]