http://www.perlmonks.org?node_id=367907

Scarborough has asked for the wisdom of the Perl Monks concerning the following question:

In the past I've written some simple server/client programs using Java on a windows platform so I'm fairly certain I can use Perl style sockets to build a server and client. However all the info. I can find here in the Monastery, cpan and various cook books seems to concentrate on UNIX.

I'm still in the experimental stage and nothing is working yet can anyone give me a clue where to find some windows specific info. about setting up a server and client on the same machine.

I've been trying to use IO::Socket::INET is this the right road to follow?

Replies are listed 'Best First'.
Re: Network programming using sockets
by JaWi (Hermit) on Jun 18, 2004 at 11:12 UTC
    The ``socket-fu'' of Perl is very much cross-platform. So, almost any example you find on Perl-UNIX socket programming, should work with windows.
    To get back to your question: yes, IO::Socket::INET is a good point to start. In addition: you can find many good examples of socket-programming in the perlipc manpage.

    -- JaWi

    "A chicken is an egg's way of producing more eggs."

Re: Network programming using sockets
by SirBones (Friar) on Jun 18, 2004 at 12:13 UTC

    Perl Cookbook has excellent coverage of sockets and client/server programming (Chapter 17.)

    I'm in the midst of porting some Java based c/s applications to Perl. Our stuff is very much cross-platform; the Java code had to run on Windows, Linux, and (*gasp*) even OS/2. I can attest that Perl is just as robust as Java in its socket/networking support. And I haven't had to worry about the particular platform so far.

    "This bounty hunter is my kind of scum: Fearless and inventive." --J.T. Hutt
Re: Network programming using sockets
by NetWallah (Canon) on Jun 18, 2004 at 13:34 UTC
    The simplest model I have found for sockets is the IO::All module. I havent personally tested IO::All sockets on win32, but it is worth examining. Sample code:
    ### Server ######## use IO::All; my $socket = io(':12345')->fork->accept; $socket->print($_) while <DATA>; $socket->close; __DATA__ On your mark, Get set, Go! ##############Here is the client code: use IO::All; my $io = io('localhost:12345'); print while $_ = $io->getline;

    Offense, like beauty, is in the eye of the beholder, and a fantasy.
    By guaranteeing freedom of expression, the First Amendment also guarantees offense.

Re: Network programming using sockets
by McMahon (Chaplain) on Jun 18, 2004 at 14:27 UTC
    I highly recommend Network Programming With Perl by Lincoln D. Stein.
    It is full of great example code-- I've always found an example that I could start from to get the job done.
Re: Network programming using sockets
by dont_you (Hermit) on Jun 18, 2004 at 23:36 UTC
    Take a look at Net::EasyTCP - "Easily create secure, bandwidth-friendly TCP/IP clients and servers". Works fine on windoze too.
    José