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>
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|