Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: Setting Up a UDP Client

#!/bin/perl -tw
my $remote_host="127.0.0.1";     
my $remote_port=80;               
my $protocol="udp";              
use Socket qw(AF_INET SOCK_DGR

Perl: Create a UDP server

#!/usr/bin/perl -w
  use strict;
  use IO::Socket;
  my ($sock,   # Socket
      $serv_msg, # server message
      $clt_msg, # client message

Perl: How to Get the DNS address of a host

#!/usr/bin/perl
use Socket;
$host = 'www.yahoo.fr';
# Extraction de l'adresse DNS
$dns_address = inet_ntoa(inet_aton($host));
# print yahoo DNS Adres

Perl: upload and download files from an FTP server

#!/usr/bin/perl -w
use Net::FTP;
$username = "test_username";                
$password = "test_mot_de_passe";            
$remotefile = "index.html"

Perl: Create a Server using Socket module

#!/usr/local/bin/perl
use Socket;
my $server_port=80;         
socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
# Start Server
setsocko

Perl: send email

#!/usr/bin/perl -w
use Mail::Mailer;
my $from_address="moi@email.com";           
my $to_address=  "lui@email.com";           
my $subject="Good news

Perl: Reading Mail with POP3

#!/usr/local/bin/perl
my  $mail_server="mail.serveur.com";            
my  $username = "test_username";                
my  $password = "test_passwor

Perl: Send and receive messages using Socket Module

use IO::Socket;
# Send message
$server->send($message_to_send, $flags)
    or die "Error: $!n";
 # read message
$server->recv($received_message, $max

Perl: Accessing a remote host using Socket::INET module

#!/usr/local/bin/perl
use IO::Socket;
my $remote_host="127.0.0.1";      
my $remote_port=80;               
my $protocol="tcp";              
$socket

Perl: Identifying the Other End of a Socket

#!/usr/bin/perl
use Socket;
$other_end   = getpeername(SOCKET)
    or die "Couldn't identify other end: $!n";
($port, $iaddr)    = unpack_sockaddr_in

Perl: download file from FTP server

use Net::FTP;
$username = "test_username";                
$password = "mypassword";            
$remotefile = "index.html";                 # File t

Perl: DNS Lookups

#!/usr/bin/perl
use Socket;
$address  = gethostbyname("www.tubedir.com")
    or die "Can't resolvet $hostname : $!";
$hostname = gethostbyaddr($addre

Perl: Ping remote host

 #!/usr/local/bin/perl
use strict;
my $ping = Net::Ping->new("tcp");
(defined $ping)
    or die "Cannot define Ping Object: $!n";
if ($ping->ping

Perl: How to connect to an FTP server and transfer files

#!/usr/bin/perl
use warnings;
use strict;
use Net::FTP;
my $ftp = Net::FTP->new("ftp.monserveurFTP.com", Timeout => 60)
		or die "Couldn't connect:e: