Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Well, if i connect to the modem directly with Putty for example and execute the same command I'm getting the expected feedback. I also tried different modems with the same result. I think for some reason the response is not ending up the file handle. If you look at the first code I posted you see that the loop to output the response should only be entered if there is anything in the filehandle. But it never entered it. In the second code it's just getting stuck as there is nothing in the filehandle as well. Could you maybe explain more detailed (or provide links) what you mean with "more explicit file handle discipline"? I'm not a very experienced programmer so I would need more input to understand :) I tried both now - read and sysread. But both loops are not beeing entered at all:
my $read; my $sysread; #Reading the response print "reading...\n"; while ( read(PORT,$read,2048) ) { print "using read:\n"; print $read; } while (sysread(PORT, $sysread, 10000)) { print "using sysread:\n"; print $sysread; }
Here's what's happening:
c:\Dropbox\Scripts>perl PortTest.pl Enter AT command:ATI0 Sending: 'ATI0' reading... done! c:\Dropbox\Scripts>

In reply to Re^2: Trying to read from serial port - not getting a response by adiuva
in thread Trying to read from serial port - not getting a response by adiuva

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (11)
    As of 2014-08-20 14:49 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (116 votes), past polls