Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can not give control back to procomm

Status
Not open for further replies.

polluxtech

Programmer
Dec 14, 2009
15
CN
when i am using rget command,i writed code like this,but i does not work as my expected: (remote target is a linux guy)

transmit "echo done ^m"
String receiveLine
set aspect RXDATA ON
rget receiveLine
while 1
rget receiveLine
if strfind receiveLine "done"
rget receiveLine $RXCOUNT
exitwhile
endif
endwhile
set aspect RXDATA OFF

but i need to press a enter key to have the procomm got the control. Need help! Thanks
 
Sorry, didn't see this until now. Are you still having trouble with this? I almost never use set aspect RXDATA ON, did you have a particular reason to do that? What happens if you run the script without that line?

 
from the help document:
aspect rxdata ON/OFF
Specifies whether Procomm Plus or a script processes characters received from the communication port. The default, OFF, indicates that Procomm Plus processes received characters. With set aspect rxdata ON, the script must handle incoming data with commands like comgetc. With set aspect rxdata ON, commands dependent upon received data, such as waitfor and when target are only checked when characters are retrieved from the receive data buffer. fetch returns 0 for OFF or 1 for ON.

I want to get the commands result which response from remote linux machine. I will analysis/parse the result and then decide whether the command was run success or fail. For some reason, the data from the remote dose not allow to show in the term.
Note, these were lots of commands will be running one by one automatically.

So I write a function below to send the command and save the returned data:

String receiveData

proc sendData
param String cmdLine
String receiveLine
receiveData=""
strcat cmdLine "^M"
transmit cmdLine
set aspect RXDATA ON
rget receiveLine ; capture the command we just transmitted above to keep it from showing on screen
while 1
rget receiveLine
if strfind receiveLine "done"
rget receiveLine $RXCOUNT
exitwhile
endif
strcat receiveData receiveLine
endwhile
set aspect RXDATA OFF
usermsg "%s`r`n" receiveData
endproc

Please help me to review the code, thanks.
 
So are you not getting any data in the receiveLine variable? I would try one time with set aspect RXDATA ON commented out. If that doesn't work, I would use Procomm's Monitor Window to see what the remote system is sending. I've copied some information from my site below on how to use that:

Procomm's Monitor Window can be used to view the incoming and outgoing data, in both hex and ASCII format. To activate this window, select the Data | Monitor Window menu item. Resize the Monitor Window so that you can view the entire width of the window, then click back in the Procomm Plus window so that the Monitor Window does not have focus. Incoming text is displayed in red, while text you send is colored blue. The Monitor Window can be handy for viewing incoming escape sequences (to determine if Procomm Plus is responding properly to them) or to verify that the program is sending the data you think it should be.

 
Hi knob
Thanks very much!
I coommented the line set aspect RXDATA ON and it works.
It take a long long time to complete the proc. It take a very short time when I use waitfor command,but I can't get the result which response by the command that I sent when I use the waitfor command.
Please help me to improve the performance.
 
My initial hunch is that rget is pausing 30 seconds each time it is called, waiting for the default 256 characters to be received before exiting. You could cut down the time to wait by using a command like this:

rget receiveLine
rget receiveLine $RXCOUNT

becomes:

rget receiveLine 256 10
rget receiveLine $RXCOUNT 10

This would have each rget command take a maximum of 10 seconds (you could cut this down more if you think it OK), which should cut down the time for the procedure to execute.

Another option would be changing the character that the script looks for to indicate the end of a line has been received (this is done using the set aspect rgetchar). If the default carriage return is not what is being sent, you can use the Monitor Window to determine what is being sent and key on that instead.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top