mchat_client.pl (Chapter 21)

The mchat_client.pl script implements the client side of the multicast chat system developed in Chapter 21.

 0 #!/usr/bin/perl -w 1 # file: chat_client.pl 2 # chat client using UDP 3 use strict; 4 use IO::Socket; 5 use IO::Select; 6 use ChatObjects::ChatCodes; 7 use ChatObjects::MComm; 8 use IO::Socket::Multicast; 9 use Sys::Hostname; 10 $SIG{INT} = $SIG{TERM} = sub { exit 0 }; 11 my ($nickname,$comm,$mcomm); 12 # dispatch table for commands from the user 13 my %COMMANDS = ( 14 channels => sub { $comm->send_event(LIST_CHANNELS) }, 15 join => sub { $comm->send_event(JOIN_REQ,shift) }, 16 part => sub { $comm->send_event(PART_REQ,shift) }, 17 users => sub { $comm->send_event(LIST_USERS) }, 18 public => sub { $comm->send_event(SEND_PUBLIC,shift) ...

Get Network Programming with Perl now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.