use warnings; # use strict; use IO::Socket; use Socket; my $port = shift || 2000; my $socket = IO::Socket::INET->new( LocalPort => $port, Type => SOCK_STREAM, Reuse => 1, Listen => 10, ) or die "Couldn't create server: $@\n"; while (my $client = $socket->accept()) { my ($port, $iaddr) = unpack_sockaddr_in($client->peername()); #### GET TIME #### $t = time(); my $then = localtime($t); #### GET IP #### my $ip_address = inet_ntoa($iaddr); open(PLOT,">>label-log.txt") || die("This file will not open!"); seek PLOT,0,2; print PLOT "$ip_address $then \n"; close(PLOT); sleep(5); system ("start /b C:\\momlabels\\transfer.bat"); $client->send(inet_ntoa($iaddr)); $client->close(); }