Bro. Doug has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed monks,
I have a problem which has cost me a great deal of time and money. Five of forty-five PC's on a network won't print to a socket. The other forty handle this simple task just fine.
As it turns out, the five PC's are all the same model: Emachines T2862. When running a command like the one below it will hang forever.
Here's a working mockup of the socket connection.
The above (readmore enclosed) code runs on my Mac, and is culled from the application. It will probably run for you, too. But maybe someone has a T2862 with ActiveState Perl... does it run for you?
Peace, monks.
I have a problem which has cost me a great deal of time and money. Five of forty-five PC's on a network won't print to a socket. The other forty handle this simple task just fine.
As it turns out, the five PC's are all the same model: Emachines T2862. When running a command like the one below it will hang forever.
print PM_SCK $out ;
Here's a working mockup of the socket connection.
#! /usr/bin/perl -wT use strict ; use warnings ; use diagnostics ; use Socket ; use IO::Select ; my @pm_send = () ; # These should be altered by a config file, but for now # I've given the addies for the monastery my $PM_ADDR = '209.197.123.153' ; my $PM_PORT = 80 ; # Start the connection to the socket my $proto = getprotobyname( 'tcp' ) ; socket( PM_SCK, AF_INET, SOCK_STREAM, $proto ) ; my $pm_in = sockaddr_in( $PM_PORT, inet_aton( $PM_ADDR ) ) ; connect( PM_SCK, $pm_in) || warn "Can't create pm_sck: $!" ; # set up autoflush select( PM_SCK ) ; $| = 1 ; select ( STDOUT ) ; # set up an IO::Select for polling PM_SCK my $sck_poller = new IO::Select ; $sck_poller->add( \*PM_SCK ) ; # now, after some tedium related to the application, # I do something that looks like: push @pm_send, "Some data" ; # and then, in a main loop, I: sck_poll() ; sub sck_poll { if ( scalar @pm_send ) { my @writeable = $sck_poller->can_write(0) ; if( scalar @writeable ){ my $out = shift(@pm_send) . chr(1) ; #this is the part that hangs forever. print PM_SCK $out ; print "You did it! \n" ; } } }
The above (readmore enclosed) code runs on my Mac, and is culled from the application. It will probably run for you, too. But maybe someone has a T2862 with ActiveState Perl... does it run for you?
Peace, monks.
Bro. Doug :wq
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: E-Machines T2862 won't print to a socket.
by quester (Vicar) on Oct 31, 2006 at 05:31 UTC | |
Re: E-Machines T2862 won't print to a socket.
by jbert (Priest) on Oct 31, 2006 at 10:42 UTC | |
Re: E-Machines T2862 won't print to a socket.
by gellyfish (Monsignor) on Oct 31, 2006 at 08:59 UTC | |
Re: E-Machines T2862 won't print to a socket.
by greatshots (Pilgrim) on Oct 31, 2006 at 04:12 UTC | |
Re: E-Machines T2862 won't print to a socket.
by derby (Abbot) on Oct 31, 2006 at 12:47 UTC |
Back to
Seekers of Perl Wisdom