Quiq::Socket - TCP-Verbindung zu einem Server
IO::Socket::INET
Quiq::Object
Ein Objekt der Klasse repräsentiert eine TCP-Verbindung zu einem Server. Der Verbindungsaufbau erfolgt mit der Instantiierung des Objekts.
Die Klasse ist abgeleitet von IO::Socket::INET und besitzt folglich alle Methoden dieser Klasse.
Sende GET-Request an Google und gib die Antwort aus:
my $sock = Quiq::Socket->new('google.com',80); print $sock "GET /\n"; while (<$sock>) { print; }
$sock = $class->new($host,$port,@opt);
Wirf keine Exception, wenn der Verbindungsaufbau fehlschlägt, sondern liefere undef.
undef
Baue eine TCP-Verbindung zu Host $host und Port $port auf und liefere eine Referenz auf das Socket-Objekt zurück.
$data = $sock->slurp;
Lies alle Daten bis der Socket geschlossen wird. Die Methode ist nützlich, um eine HTTP-Antwort zu lesen.
$sock->close;
1.207
Frank Seitz, http://fseitz.de/
Copyright (C) 2023 Frank Seitz
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Quiq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Quiq
CPAN shell
perl -MCPAN -e shell install Quiq
For more information on module installation, please visit the detailed CPAN module installation guide.