For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2005 > Re: serial programming in Perl,









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: serial programming in Perl,
Laxmi Goudappa Patil

2005-04-28, 8:56 am

_Hi All,

Thanks for your response.

sorry (for bad subject).. i'll take care of that from next time.

The operating system im working on is SCO Unix, and the device(port) is /dev/tty1a

The code looks something like this.

writeport($request); #writing connect request
my(@READYFD) = $FD_SET->can_read(0);
foreach $fd (@READYFD){
print "Inside foreach : $fd";

my $msg = readport($FD);#expecting "PAD:" characters
if($msg eq $PAD){} #ignoring those characters
$msg = readport($FD); #expecting "CC" call connect
print "message is $msg ";
print "call connect :$CallConnect";
sleep(0.5);
if(($fd == $FD) && ($msg eq $CallConnect)){
print "inside call connect";
$msg = readport($FD); #expecting XON before writing mesg
if($msg eq $XON){
writemesg($port);
}

like this goes on..
Actually i always a expect some message in response to the request i sent.finally i write actual message to the port.
Above, after first read call, if the other end is not writing anything means, should return an empty string is it?? but it's returning the same characters, the first read call returns.. so should i have to flush the file descriptor before second read?? ifso how to use it ?? i tried to make the situation understandable..Hope this is what you expected , to help in this regard.


Thanks.

On Wed, 27 Apr 2005 Chris Devers wrote :
>Please use a descriptive subject line. Half the spam I get has "Hello"
>for a subject, so yourmessage nearly got flagged as spam & deleted.
>
>On Wed, 27 Apr 2005, laxmi goudappa patil wrote:
>
>
>What operating system are you working on? Windows? Linux? Other?
>
>What does your code look like? It's impossible to make suggestions
>without being able to read thesection of code that isn't behaving.
>
>More information is needed in order to help you.
>
>
>
>--
>Chris Devers


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com