I took over as maintainer of Net::Daemon a number of years ago because I had a patch for it, because the maintainer at the time could not be found, and because the original author let me know he no longer does this sort of thing. One would have to know both threads and sockets programming, neither of which I actually know, but there was noone else. I need help now for Net::Daemon on Windows. Specifically, with some code in the file Net-Daemon\t\thread.t.
t/thread.t ...... Error while reading 0: 0 () at t/thread.t line 42.A daemon child is opening up a handle to a port, then writing to it, flushing the handle, and then reading from the same handle. The writing to the handle works. The reading from the handle no longer works. The code used to work. Can anyone take a look at this?
To repeat the results,The actual code from thread.t that fails is pasted below. The line with "Error while reading ..." is what always prints out. Again, this code always used to work. The $port number is typically in the 3 thousands range.
my($handle, $port) = Net::Daemon::Test->Child ($numTests, $^X, 't/server', '--timeout', 20, '--mode=threads'); print "Making first connection to port $port...\n"; $fh = IO::Socket::INET->new('PeerAddr' => '127.0.0.1', 'PeerPort' => $port); printf("%s 3\n", $fh ? "ok" : "not ok"); eval { for (my $i = 0; $i < 20; $i++) { if (!$fh->print("$i\n") || !$fh->flush()) { die "Error while writing $i: " . $fh->error() . " ($!)"; } my $line = $fh->getline(); die "Error while reading $i: " . $fh->error() . " ($!)" unless defined($line); die "Result error: Expected " . ($i*2) . ", got $line" unless ($line =~ /(\d+)/ && $1 == $i*2); } };
In reply to Cannot read socket fh in Net::Daemon test by mnooning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |