Re: Perl, GTK, Network
- From: ArtÅras Ålajus <x11 h2o pieva net>
- To: mark knm org
- Cc: gtk-perl-list gnome org
- Subject: Re: Perl, GTK, Network
- Date: Sat, 13 Dec 2003 16:58:43 +0200
I'll just pass an example:
my $vyc = Net::Vypress::Chat->new;
# listen on udp
my $listen = Gtk2::Helper->add_watch ( $vyc->{'listen'}->fileno, "in",
sub { do_stuff($vyc->{'listen'}); } );
sub do_stuff {
my $listen = shift;
my $buffer;
$listen->recv($buffer, 1024);
my @r = $vyc->recognise($buffer);
my $type = shift @r;
if ($type eq "chat") {
my ($who, $text, $chan) = @r;
add_text($buffer{$chan}, "<$who> $text");
}
.....
}
and the $vyc->{'listen'} is:
$self->{'listen'} = IO::Socket::INET->new (
LocalPort => $self->{'port'},
ReuseAddr => 1,
Proto => 'udp') || croak ("Can't establish"
." listen socket: $!");
--
Sincerely, ArtÅras 'arturaz' Ålajus
You can find me at:
irc.freenode.org: nick arturaz
irc.data.lt: nick arturaz
ICQ: 157929934
Jabber: arturaz akl lt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]