Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

exchanging strings on the network

by bahadur (Sexton)
on May 10, 2005 at 10:10 UTC ( [id://455495]=perlquestion: print w/replies, xml ) Need Help??

bahadur has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to exchange strings between two perl programs. e.g
SCRIPT1. how are u.

SCRIPT2. i am fine.\n

SCRIPT1. whats up.\n

SCRIPT2. nothing much\n
i am using IO::Socket::INET. I have two problems. First, i am unable to exchange strings with each other. secondly i take the hostname and port number from command line. but when i try to do some thing like this
my $client = IO::Socket::INET->new( PeerAddr => '$host', PeerPort => '$port', Proto => 'tcp',)
it gives me an error that it cannot connect. but when i replace the values with hardcoded ones it works ok. can any one write up full running code where i can exchange strings between two scripts using IO::SOCKET::INET. also the host and port number have to be taken from the command line.

Replies are listed 'Best First'.
Re: exchanging strings on the network
by holli (Abbot) on May 10, 2005 at 10:17 UTC
    Try PeerAddr => "$host",, perhaps you could also read perlquot.


    holli, /regexed monk/
      i have tried it with double quotes as well as single quotes and as well as a no quotes
        Are you sure those variables contain what you think? put a print in your code and check that. If that doesn't work, post what you have tried so far.
        print "PeerAddr:$host:, PeerPort:$port:\n";


        holli, /regexed monk/
Re: exchanging strings on the network
by Adrade (Pilgrim) on May 11, 2005 at 01:13 UTC
    Given that I didn't see the postings several layers deep, the post that follows my no longer be relevant. It remains anyway :-)   -Adam
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://455495]
Approved by gellyfish
Front-paged by diotalevi
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-23 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found