in reply to exchanging strings on the network

Try PeerAddr => "$host",, perhaps you could also read perlquot.


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: exchanging strings on the network
by bahadur (Sexton) on May 10, 2005 at 10:22 UTC
    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/
        here is my code this is for the client
        print "Hello welcome to the fsclient\n"; my ($user, $passwd, $host, $port, $command, $numArgs); $numArgs = $#ARGV + 1; $command=$ARGV[7]; my $client = IO::Socket::INET->new( PeerAddr => 'charlie', PeerPort => '70000', Proto => 'tcp',) or die "cannot connect to $port at $host\n"; while(<$client>) { print $_; print $client "Username $user Pass $pass";} close($client) or die "$!\n"; print "connection closed\n";
        this is the code for the server
        #!/bin/perl -w use IO::Socket::INET; use strict; print "Hello welcome to the Fs server\n"; my $server = new IO::Socket::INET ( LocalHost => 'charlie', LocalPort => '70000', Proto => 'tcp', Listen => 1, Reuse => 1, ); die "Could not create socket: $!\n" unless $server; print "Great just created a socket\n"; my $new_sock = $server->accept(); print $new_sock "Fileshare Version 0.1\n"; while(<$new_sock>) { print "Here is what i received from you\n"; print "$_\n";} print "OK its time to close\n"; close($server);
        UPDATE: ok the it is working with double quotes now plus right now the client is receiving the string "Fileshare Version 0.1" . but when it tries to send the user name password to the server it doesnt happen.