Hi,

While I'm not a sockets expert, I believe you'll have to make your server
multi-threaded to support multiple simulaneous client connections.  In the
perlipc doc there's a simple multi-threaded server sample if it helps.

After your main server program does the accept(), it needs to spawn a child
process to handle the communication with the client so the server can
immediately go back to accept() again.

Good luck.

-----Original Message-----
From: Kristofer Wolff [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 07, 2001 8:14 AM
To: perllist
Subject: socket
Importance: High


hi list, again...


I have this ( question follows )

--
while($server)
{
        my $r;
        while(length($r)<10)
        { my $st_rand = int((rand) * 9)+0; $r .= "$st_rand";}
        $client{$r} = $server->accept();
        my $this = $client{$r};
        print $this "hello\r\n";
        while(read($this, $out, 1))
        {
                print $out;
        }
}
--

while the first user is looged it, no other will be prompt on my screen.

so i tryed this:

--
while($server)
{
        my $r;
        while(length($r)<10)
        { my $st_rand = int((rand) * 9)+0; $r .= "$st_rand";}
        $client{$r} = $server->accept();

        while(keys %client)
        {
                foreach $t(keys %client)
                {
                        my $this = $client{$t};
                        read($this, $out, 1);
                        print $out;
                }
        }
}
--

but still the same !


my question is: how can i make a server, that takes all client input and
prints it out, whisout hanging in a while-loop ?

???

Please help me.

kris

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
  • socket Kristofer Wolff
    • Gert Lombard

Reply via email to