Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This is an interesting issue... I've written a small client program to connect to a certain port, send a query and receive back some information.
#!/usr/bin/perl use strict; use warnings; # usage: ./ mac_address use Carp; use IO::Socket::INET; die "Could not create socket: $!" unless my $sock = IO::Socket::INET->new( PeerAddr => '', PeerPort => xxxx, Proto => 'tcp', Type => SOCK_STREAM, Timeout => 10, ); foreach my $cmd (@ARGV) { print $sock "$cmd\n" or die $!; } print $sock "EOT\n" or die $!; my @text = <$sock>; close($sock) or die $!; print @text;
This script runs fine when I ssh to the LTSP server and run it from the command line. However, each LTSP terminal that will run this script takes its filesystem from the server, and the only writable directory is /tmp - the rest are read-only. When I try to run the script from the LTSP terminal's command line, I get the error "Could not create socket: Invalid argument at /usr/local/bin/ line 11."

Can anyone tell me why this is the case, and better yet how to resolve this issue? Thanks in advance!

Update: Resolved!! The issue lies somewhere in the hostname lookup. Changing the PeerAddr from using the name to using the IP resolved my issue. I still need to figure out why that's a problem, but at least now my project can progress. Thanks again to the responders, especially Thelonius for reminding me to use the debugger.

It's all fine and dandy until someone has to look at the code.

In reply to IO::Socket::INET and LTSP read-only filesystem by kwaping

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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2023-05-30 16:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found