UNIX Domain Sockets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Didatus

    UNIX Domain Sockets

    i have a problem to send data over an unix domain socket
    after the socket is created i am reading data from stdin und want to
    send it over socket to a listener but i get an error. He can't write
    into the socket.

    This is my program:

    #!/usr/bin/perl -w
    use strict;
    use IO::Handle;
    use IO::Select;
    use IO::Socket::UNI X;
    use Getopt::Long;
    Getopt::Long::C onfigure("bundl ing");
    $|=1;
    my $usock = "";
    GetOptions ('socket|s=s' => \$usock);
    my $sock;
    $sock = IO::Socket::UNI X->new(PeerAddr => "$usock",
    Type => SOCK_STREAM,
    Timeout => 10 );
    die "could not open socket: $!\n" unless $sock;
    my $in = new IO::Handle;
    $in->fdopen(fileno( STDIN),"r");
    $in->blocking(0);
    my $select = new IO::Select ($in);
    while($select->can_read(200 ))
    {
    my $data = '';
    while(my $length = $in->sysread($data, 4096))
    {
    my $newlen = $sock->syswrite($data ,$length);
    }
    }
  • nobull@mail.com

    #2
    Re: UNIX Domain Sockets

    christian.hamme r@dynarize.de (Didatus) wrote in message news:<a948a960. 0308180249.4f2b 7e29@posting.go ogle.com>...[color=blue]
    > [...] i get an error [...][/color]

    Saying "i get an error" without saying what that error is, is one of
    those things you just should not do.

    This newsgroup does not exist (see FAQ). Posting to newsgroups that
    don't exist is also best avoided.

    Comment

    Working...