467,136 Members | 1,328 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,136 developers. It's quick & easy.

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::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);
}
}
Jul 19 '05 #1
  • viewed: 2927
Share:
1 Reply
ch**************@dynarize.de (Didatus) wrote in message news:<a9**************************@posting.google. com>...
[...] 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.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by afalanga@syracusenetworks.com | last post: by
reply views Thread by Joseph Dionne | last post: by
5 posts views Thread by Virgil Green | last post: by
15 posts views Thread by Alpha | last post: by
reply views Thread by mandarkraftware@gmail.com | last post: by
21 posts views Thread by Tom Gur | last post: by
1 post views Thread by Chris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.