IO::Socket.pm 
Author Message
 IO::Socket.pm

Hi-

I'm looking for an example of a script that uses IO::Socket.pm and reads
and writes over a socket.  The documentation for IO::Socket doesn't
contain any examples, and I haven't had any luck searching DejaNews.  The
camel book doesn't talk about IO::Socket.

I ask this question because I am trying to write a script that I think
should work, but doesn't.  I have read the section in the camel book on
IPC, and have attempted to implement what I'm trying to do by modifying
the example code given.  However, I don't really understand the
nitty-gritty of how sockets work, and I had hoped that using IO::Socket.pm
would shield me from some of this.

Can anybody point me to a very simple script which reads and writes to a
socket using IO::Socket.pm?  I'm most interested in Unix-domain sockets,
not Internet-domain sockets, but I'll take what I can get.

Thanks for any help you can give.

-Ken Williams
 The Math Forum



Tue, 11 Jan 2000 03:00:00 GMT  
 IO::Socket.pm

Quote:

> I'm looking for an example of a script that uses IO::Socket.pm and reads
> and writes over a socket.  The documentation for IO::Socket doesn't
> contain any examples, and I haven't had any luck searching DejaNews.  The
> camel book doesn't talk about IO::Socket.

From the IO::Socket man page:

       Examples:

          $sock = IO::Socket::INET->new(PeerAddr => 'www.perl.org',
                                        PeerPort => 'http(80)',
                                        Proto    => 'tcp');

          $sock = IO::Socket::INET->new(PeerAddr => 'localhost:smtp(25)');

          $sock = IO::Socket::INET->new(Listen    => 5,
                                        LocalAddr => 'localhost',
                                        LocalPort => 9000,
                                        Proto     => 'tcp');

In case it's not clear from this man-page, an object of type
IO::Socket (or it's ilk, eg. IO::Socket::INET) are usable as objects
of type IO, which means you can print, <>, write, read, syswrite and
generally make a pain of yourself on them.

                        -AJS



Tue, 11 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. 2-way sockets with IO::Socket.pm

2. timeouts fail in IO::Socket.pm

3. Socket/inet_aton.pm not found in AIX 4.1.3 build (IO::Socket)

4. libnet and taint mode -> insecure dependancy in IO::Socket.pm

5. Proper way to close an IO::Socket or IO::Socket::INET

6. IO::Socket, IO::Select, and buffered/unbuffered IO

7. HELP - errors related to AutoLoader.pm, Entitiy.pm, Internet.pm, IO/Wrap.pm, Head.pm

8. ActivePerl, Win2K, non-blocking, IO::Socket, IO::Select

9. question about io::socket & io:select

10. IO::Select and IO::Socket question: multiple connections

11. IO::Socket && IO::Select Problem

12. IO::Select and IO::Socket question: multiple connections

 

 
Powered by phpBB® Forum Software