pokemonk has asked for the wisdom of the Perl Monks concerning the following question:
So, if i send "start" to the server, it will return "Welcome to the game: ", but if i send "newUser<div>username", the server returns "Welcome to the game: username" and sometimes it returns "username has been added to the database, and sometimes i'll return both!!!use IO::Socket::INET; my $sock = new IO::Socket::INET ( LocalPort => 6547, Listen => 10, Proto => 'tcp', Reuse => 1 ); print "Waiting For Requests!!\n"; while(my $client = $sock->accept()){ print "Connection!\n"; my $blah=<$client>; handle($blah,$client); $client->close(); } sub handle{ my ($data,$client) = @_; chomp($data); my ($command, $param) = split '<div>',$data; print "$command\n"; if($command == 'start'){ print $client "Welcome to the game: $param\n"; } if($command == 'newUser'){ print $client "$param Has been added to the database!!\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Server Problem
by wog (Curate) on Nov 23, 2001 at 20:31 UTC | |
Re: Server Problem
by MZSanford (Curate) on Nov 23, 2001 at 20:30 UTC |