develooper Front page | perl.ithreads | Postings from January 2007

Re: Accept / Connect will block using threads and UNIX domainsockets

Thread Previous
From:
Christopher Fowler
Date:
January 23, 2007 13:10
Subject:
Re: Accept / Connect will block using threads and UNIX domainsockets
Message ID:
1169586603.17659.69.camel@shuttle.linxdev.com
This seems to block correctly using 5.8.8 on i686 Linux.  My guess is
that it is related to cygwin?

On Tue, 2007-01-23 at 21:57 +0100, Sebastian Weber wrote:
> #!/usr/bin/perl
> use threads;
> use Socket;
> 
> unlink ("/tmp/mysock");
> if (fork) {con_thread();exit;}
> 
> socket (SOCK1,PF_UNIX,SOCK_STREAM,0) or die "socket(): $!";
> bind (SOCK1, sockaddr_un("/tmp/mysock")) or die "bind(): $!";
> listen(SOCK1,SOMAXCONN) or die "listen(): $!";
> accept (CLIENT,SOCK1);
> 
> sub con_thread {
>      sleep(2);
>      socket(SOCK2, PF_UNIX, SOCK_STREAM, 0) or die "socket(): $!";
>      connect(SOCK2, sockaddr_un("/tmp/mysock")) or die "connect():
> $!";
> }
> 
> Does anybody have any idea why?? Is there a workaround?
> BTW: Im using Perl v5.8.7 built for cygwin-thread-multi-64int
> 


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About