Re: serial programming in Perl,



 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?? if so 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 your message nearly got flagged as spam & deleted.
>
>On Wed, 27 Apr 2005, laxmi goudappa patil wrote:
>
> > Doing serial programming in perl. when i read a port, if there is data
> > on the port it reads successfully. if there is no data at that moment
> > im recieving the same data which hasn't written to the port..
> >
> > i have two parts of the program.. one is writing to the port, and the
> > other is reading from the port..can you please help, understanding why
> > it's happening like this?? and what can i do to overcome this
> > problem??
>
>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 the section of code that isn't behaving.
>
>More information is needed in order to help you.
>
>
>
>--
>Chris Devers


Relevant Pages

  • Re: Best Plan of action for 2 forest.......
    ... PortQry reports the status of a port in one of the following ways: ... ..LISTENING This response indicates that a process is listening on the target ...
    (microsoft.public.windows.server.active_directory)
  • RE: MBSA and MSs attempts at "security"
    ... >the port status of TCP and UDP ports on a computer you choose. ... you can also query an LDAP service. ... LDAP query and interpret an LDAP server's response to ...
    (Focus-Microsoft)
  • RE: Using a dynamic request - response port
    ... Saravana Kumar ... I don't have any direct experience working with WSS adapter, ... You need to make sure, you are getting some response back from Sharepoint ... May be its worth investigating using a static solict-response send port ...
    (microsoft.public.biztalk.general)
  • Re: Cant connect to Mailserver
    ... chance yet to dig into the server and find out why. ... When I telnet to port 25 I should get a response from your exchange ... Are the correct ports open in the router? ...
    (microsoft.public.windows.server.sbs)
  • Re: how to set timeout for read command
    ... >> The shell will attempt to connect to that TCP port, get an error response, ... The desired behavior of the program is to ... in response to the refusal to open the connection. ... The remote machine has something listening on the port, ...
    (comp.unix.shell)