kwaping has asked for the wisdom of the Perl Monks concerning the following question:
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.
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/ltsp_client.pl 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.
#!/usr/bin/perl use strict; use warnings; # usage: ./ltsp_client.pl mac_address use Carp; use IO::Socket::INET; die "Could not create socket: $!" unless my $sock = IO::Socket::INET->new( PeerAddr => 'xxxx.xxxx.com', 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;
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO::Socket::INET and LTSP read-only filesystem
by NetWallah (Canon) on Apr 17, 2007 at 03:17 UTC | |
by kwaping (Priest) on Apr 17, 2007 at 15:05 UTC | |
Re: IO::Socket::INET and LTSP read-only filesystem
by Thelonius (Priest) on Apr 17, 2007 at 01:51 UTC | |
by kwaping (Priest) on Apr 17, 2007 at 14:57 UTC | |
Re: IO::Socket::INET and LTSP read-only filesystem
by ikegami (Patriarch) on Apr 17, 2007 at 22:11 UTC | |
Re: IO::Socket::INET and LTSP read-only filesystem
by glenn (Scribe) on Oct 17, 2008 at 15:17 UTC | |
by glenn (Scribe) on Oct 18, 2008 at 19:09 UTC |
Back to
Seekers of Perl Wisdom