Created
July 27, 2011 12:21
-
-
Save Arthurmourao/1109242 to your computer and use it in GitHub Desktop.
Um client que envia o conteúdo de um arquivo de texto(ou equivalente) para o server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
use IO::Socket::INET; | |
$client = IO::Socket::INET->new( | |
PeerAddr=>"localhost", # host do server o server está listening | |
PeerPort => "8081", # porta em que | |
Timeout => 60); # timeout de conexao | |
open (FILE,"<","testeSplit.txt"); | |
while(<FILE>) | |
{ | |
my $arquivo = $_; | |
#$msg = "Mensagem de teste!"; | |
print "\nEnviando arquivo..."; | |
if($client->send($arquivo)) #enviando a mensagem | |
{ | |
print "-> Enviado com sucesso","\n"; | |
sleep(2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment