You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
411 B
Raku
17 lines
411 B
Raku
use Socket;
|
|
|
|
socket(SERVER, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
|
|
|
|
setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1);
|
|
|
|
$addr = sockaddr_in(2336, inet_aton('server.com'));
|
|
|
|
bind(SERVER, $addr) or die "Could not bind to port.\n";
|
|
|
|
listen(SERVER, SOMAXCONN) or die "Could not listen to port.\n";
|
|
|
|
while (accept(CLIENT, SERVER)) {
|
|
print CLIENT "Hello from the server!\n";
|
|
}
|
|
|
|
close(SERVER); |