#!/usr/bin/perl -w use strict; use warnings; use IO::Socket; my $host = "192.168.0.36"; # Your Cube-IP or hostame Here! my $port = "80"; while(1) { my $handle = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => $port ) // die("ERROR open Socket $host:$port ($!)\n"); $handle->blocking(0); binmode($handle); my $finished = 0; my $buffer=''; while($finished==0) { my $line=''; $handle->read($line,4096); $finished=1 if(index($buffer,'L:')!=-1); $buffer.=$line if(length($line)); } $handle->close(); if(!$finished) { print "No Connection\n"; next; } open(STATION, ">/home/kami/scripts/test"); foreach my $v (split("\r",$buffer)) { print STATION $v."\n"; } close (STATION); sleep(3); system("./alwindow.php", "windowsstatus"); print $?; }