Kind of a strange problem. Here is the code:
use 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;
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, ghostiLs

In reply to IO::Socket not reading from server? by ghostils

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.