Leser: 1
|< 1 2 3 >| | 30 Einträge, 3 Seiten |
1
2
3
4
5
6
my $outbuf = '';
while (read FileHandle, $buf, 28)
{ $outbuf .= $buf; # zum Senden anhängen
my $len = $socket->send($outbuf); # Sendeversuch - heißt, es muß nicht klappen
$len and substr $outbuf, 0, $len, ''; # vorn wieder abschneiden
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use strict;
use Config;
use IO::Socket::INET;
my $SocketHandle;
my $buf;
my $binFile = "<e:/test.bin";
my $Status;
unless (@ARGV == 2) { die "Usage: GetStatus.pl remotehostname port" }
$SocketHandle = IO::Socket::INET->new(PeerAddr => $ARGV[0],
PeerPort => $ARGV[1],
Proto => "tcp",
Timeout => 10,
Type => SOCK_STREAM) or die "cannot connect: $!\n";
$SocketHandle->autoflush();
open(FileHandle, $binFile);
binmode(FileHandle);
while (read(FileHandle, $buf, 28))
{
print $SocketHandle $buf;
}
$|=1;
while (read ($SocketHandle,$Status,1))
{
print($Status);
}
close FileHandle;
close $SocketHandle;
while (read ($SocketHandle,$Status,1) ne 0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
$SocketHandle = fsockopen ("localhost", 5727, $errno, $errstr, 2);
if (!$SocketHandle)
{
echo "$errstr ($errno)";
}
else
{
$FileName = "e:/test.bin";
$FileHandle = fopen ($FileName, "r");
if (!$FileHandle)
{
echo "File not found";
}
else
{
$FileContent = fread ($FileHandle, filesize($FileName));
fclose ($FileHandle);
fputs ($SocketHandle, $FileContent);
$Return = fread($SocketHandle, 1024);
echo trim(substr($Return,28));
}
fclose($SocketHandle);
}
?>
|< 1 2 3 >| | 30 Einträge, 3 Seiten |