Thread Socket-Fehlermeldung (2 answers)
Opened by Mac at 2018-10-18 15:04

Gast Mac
 2018-10-18 15:04
#188991 #188991
Hallo, bei Script:
Code (perl): (dl )
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
35
36
#!/usr/bin/perl -l

use warnings;
use strict;
#use diagnostics;

use IO::Socket;
use IO::Select;
use IO::Handle;

my $stdin = IO::Handle->new();
$stdin->fdopen(fileno(STDIN),"r");

my $remote_host = "192.168.2.2";
my $remote_port = 5000;
my $clientsock = IO::Socket::INET->new(PeerAddr => $remote_host,
                PeerPort => $remote_port,
                Proto => "tcp",
                Type => SOCK_STREAM)
                or die "Konnte kein Kontakt zu $remote_host:$remote_port herstellen : $@\n";

my $sel = IO::Select->new();
$sel->add($stdin);
$sel->add($clientsock);

my $socket;
while (1) {
        my @readyhandles = $sel->can_read();
        foreach $socket (@readyhandles) {
                if ($socket == $stdin) {
                        print $clientsock <$socket>;
                } else {
                        print <$socket>;
                }
        }
}


bekomme ich immer diese Fehlermeldung: syntax error at test4 line 31, near "$socket>"
Execution of test4 aborted due to compilation errors.

Aber was ist falsch? Gruß Mac
Last edited: 2018-10-18 15:14:32 +0200 (CEST)

View full thread Socket-Fehlermeldung