Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.
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

In reply to E-Machines T2862 won't print to a socket. by Bro. Doug

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found