1 Replies - 1886 Views - Last Post: 27 February 2010 - 12:08 PM

#1 tecta   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-March 05

Basic Socket

Posted 14 March 2005 - 06:17 PM

Description: Establish a connection.
#!/usr/bin/perl
// by tecta
// [email protected] - feel free...
use strict;
use warnings;
use IO::Socket::INET;

my $addr = 'irc.owns.us';
my $port = 'http(80)';
my $prot = 'tcp';

my $sock = IO::Socket::INET->new(
          PeerAddr          =>          $addr,
          PeerPort          =>          $port,
          PeerProt          =>           $prot,
);

if ($sock)
{
     my $newport = trim($port, "http", " ");
     print "Connected!n";
     print "$addrn";
     print "$newportn";
     print "$protn";
}
else 
{
     print "Couldn't Connect.";
}



Is This A Good Question/Topic? 0
  • +

Replies To: Basic Socket

#2 Ed_Bighead   User is offline

  • D.I.C Head
  • member icon

Reputation: 14
  • View blog
  • Posts: 178
  • Joined: 26-April 09

Re: Basic Socket

Posted 27 February 2010 - 12:08 PM

Strictly copying and pasting gives me the following error: Undefined subroutine &main::trim called at test.pl line 20. Using version 5.10.0 My guess is that you had a sub function that trimmed whitespace that you forgot to include
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1