ghostils has asked for the wisdom of the Perl Monks concerning the following question:
What it can't do: It can't receive any data, its like the socket is PermaBlocked or something. While if I use telnet to connect to my server I get all the data I could ever want when I submit my query text by hand. I"m completely confused. I've tried several variations on receiving data, and none work. The client connects to the DBIServer, then submits is query like a good little client, then it never gets the results of the query back. It just stays in a seemingly endless loop. Even if I take the while loop out of the code, and just use $Data = <$DBIClient>; it still stalls. Again the server works perfect with telnet, I just can't see why its not working here with a simple tcp perl client. Any help would be awesome. Thanks, ghostiLsuse IO::Socket; use IO::Select; use Socket; use DBI; require ("cgiforms.pl"); require ("dbsearch.pl"); #-Get User Query: Convert to DBIServer format: @SQLStrings = ParseQueryString("\x22XP 1333\x22"); @DBIServerQueries = DBIServerEncapQuery(@SQLStrings); #-Socket stuff: $remote_host = "127.0.0.1"; $remote_port = "57660"; #-Create socket, connect to server: $DBIClient = IO::Socket::INET->new(PeerAddr=> $remote_host, PeerPort=> + $remote_port, Proto=> "tcp", Type=> SOCK_STREAM); #-Loop through queries, send to server, get database results: foreach $DBIServerQuery (@DBIServerQueries) { print $DBIClient "$DBIServerQuery"; while(defined(<$DBIClient>)) {print "$_";} } print $DBIClient "DBISERVER_CLIENT_DONE\r\n"; $DBIClient->close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Socket not reading from server?
by dws (Chancellor) on Oct 02, 2003 at 22:31 UTC | |
|
Re: IO::Socket not reading from server?
by sgifford (Prior) on Oct 03, 2003 at 06:01 UTC | |
|
Re: IO::Socket not reading from server?
by Anonymous Monk on Oct 02, 2003 at 22:42 UTC | |
|
Re: IO::Socket not reading from server?
by Melly (Chaplain) on Oct 03, 2003 at 11:19 UTC |