Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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!
  • 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, 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
  • 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Eily]: hu, don't tell the other French people I never tried it, I might get kicked out :P
    choroba . o O ( The Czech at-sign is also edible )
    [Eily]: the French @ is a mouthful I guess...
    [Eily]: choroba Wikipedia gives me Zavináč which doesn't seem to translate to something edible?
    [Eily]: (yes I'm very good at using question marks, thank you)
    [Discipulus]: O_O frexit for you! even me i tried. it was in the arabic quarter in Granada; they offered as 'tapas' in bars. I eataly somewhere they eat ;=P Sardinia a Pulia iirc
    [choroba]: Zavináč

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (6)
    As of 2017-11-21 10:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:













      Results (297 votes). Check out past polls.

      Notices?