Depending on what it is that you want to do, you might consider using a higher-level library than just basic sockets. For instance, a while back I needed to put together a client/server networking module for getting backups moved from one system to another across a network. There are a number of ways I could have done it, but I ended up combining HTTP::Daemon on the one end with system('wget', @args) on the other. In retrospect, I could just as easily have used WWW::Mechanize instead of wget and/or Net::Server in lieu of HTTP::Daemon. For that matter, the one system has Apache running anyhow, so I could have used WWW::Mechanize on the one end and plain old CGI on the other. If what you're doing could use features you don't feel like implementing, such as the ability for more than one client to connect at a time, going with one of these routes is worthwhile. After all, who wants to write forking code when you don't have to?
On the other hand, if your goal is learning about networking, then writing a basic client/server socket setup is quite worthwhile. My first experiment in this was a Hello, World server -- the client would connect and say "Hello, Server World", and the server answered back, "Hello, Client World". The downside of this kind of lowlevel approach is that the server for my Hello, World thing is over forty lines, and all it does is listen for one client connection at a time, check if they say a certain thing, say a certain thing back, log it, and close the socket. That's not very much to do in forty lines of Perl.
In reply to Re: Very basic socket question
by jonadab
in thread Very basic socket question
by blazar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |