#!/usr/bin/perl

use strict;
use warnings;

use Socket;
use IO::Handle;

my $socket_name = '/tmp/mohawk_socket';

my ($srv, $cli);
socket($srv, PF_UNIX, SOCK_STREAM, 0);
unlink $socket_name;
bind($srv, sockaddr_un($socket_name)) or die "bind '$socket_name': $!";

listen($srv, 1);
        
while (accept($cli, $srv)) {
        $cli->autoflush(1);
        print $cli "Hi there...\n";
        my $answer = <$cli>;
        print $answer;
}
