UNIX Domain Sockets

Discussion in 'Perl' started by Didatus, Aug 18, 2003.

  1. Didatus

    Didatus Guest

    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::UNIX;
    use Getopt::Long;
    Getopt::Long::Configure("bundling");
    $|=1;
    my $usock = "";
    GetOptions ('socket|s=s' => \$usock);
    my $sock;
    $sock = IO::Socket::UNIX->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);
    }
    }
     
    Didatus, Aug 18, 2003
    #1
    1. Advertising

  2. Didatus

    Guest

    (Didatus) wrote in message news:<>...
    > [...] i get an error [...]


    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.
     
    , Aug 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stuart Clayman

    Java and Unix Domain sockets

    Stuart Clayman, Jul 10, 2003, in forum: Java
    Replies:
    2
    Views:
    974
    Marc Rochkind
    Jul 10, 2003
  2. Chris Markle
    Replies:
    0
    Views:
    5,066
    Chris Markle
    Apr 24, 2004
  3. Joseph Dionne

    Are Unix Domain sockets supported?

    Joseph Dionne, Mar 30, 2005, in forum: Java
    Replies:
    6
    Views:
    7,295
    Joseph Dionne
    Apr 1, 2005
  4. Fossie
    Replies:
    5
    Views:
    939
    Fossie
    Feb 11, 2004
  5. Chris Roos

    Ruby and Unix Domain Sockets

    Chris Roos, May 19, 2005, in forum: Ruby
    Replies:
    1
    Views:
    180
    Sam Roberts
    May 20, 2005
Loading...

Share This Page