Sockets: Difference between revisions
→{{header|Perl 6}}: Add Perl 6 example
(Fix UNIX Shell to run 'nc', not 'netcat'. (Some systems only have 'nc'.) Delete redundant UnixPipes example.) |
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add Perl 6 example) |
||
Line 519:
$sock->send('hello socket world');
$sock->free;</lang>
=={{header|Perl 6}}==
Will fail with a connect error if there is not a socket server of some kind available on the specified host and port.
<lang perl6>my $host = '127.0.0.1';
my $port = 256;
my $client = IO::Socket::INET.new(:$host, :$port);
$client.send( 'hello socket world' );
$client.close;</lang>
=={{header|PHP}}==
|