Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2003

    Unanswered: IO::Select and perl/tk

    I am trying to write a very simple chat echo prgram. It consists of two parts, a server and a GUI. Everything works fine (I think) except I can't get the GUI to read the data the server sends and place it in the text box. Here is the server code:
    use strict;
    use warnings;
    use IO:ocket;
    use IO:elect;
    use Socket 'inet_ntoa';
    use Sys::Hostname 'hostname';
    my $address = inet_ntoa(scalar gethostbyname(hostname() || 'localhost'));
    my $server = new IO:ocket::INET (LocalAddr => "$address:4747", Listen => 10, Reuse => 1, Proto => "tcp");
    my $sel = new IO:elect ($server);
    print "listening at $address on 4747\n";
    while (my @ready = $sel -> can_read){
    foreach my $socket ( my @ready){
    if ($socket == $server){
    my $new = $server -> accept;
    $sel -> add ($new);
    $socket -> recv(my $msg, 1024);
    $socket -> send($msg);

    The GUI code is attached. This is for a Win32 system. Any ideas. Thanks in advance.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts