Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird problem with MSCOMM
Message
From
24/03/2004 08:20:07
 
 
To
24/03/2004 05:51:51
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00888798
Message ID:
00889202
Views:
11
hey Virusim,

>01) I want to make sure that I had sent the complete command to my device
>before flushing it(i.e device reponse). I do so by setting SThreshold = 0, sent my complete command then set SThreshold = 1 to flush it. This is correct ?

SThreshold, if we can believe the documentation, sets the point at which an event is raised by the amount of data left in the output buffer. If set to 1, it should set the commevent property to 1 and raise OnComm when empty. To prove if this is so, check in your OnComm code for commevent=1, and look at the OutBufferCount. This should represent the # of characters remaining to be sent. If you just want to clear the send buffer, .OutBufferCount = 0 will do that. Changing the value of SThreshold on the fly will not.

>
>02) My device seem to had received my command and reply, but the reply is not capture by my OnComm Event(). However, on switching off the device, the reply is then detected by my OnComm event of the MSCOMM. Any way to flush the buffer ?
>Or do I had to set the inbufferSize smaller to solve this issue ?
>

My guess is that when the device is switched off, another event is raised, and now you see the data already sitting in the input buffer. If you have anything beyond a simple 3 wire interface, a change in the device state might trigger any one of the control lines and the result you see.

The important thing to remember here is that if the hardware interface requirements are met (handshaking, settings, etc.), your data will be in the control's buffer. Whether your OnComm code runs or not is entirely dependant on the state VFP is in at the moment. David Frankenbach's comments in your other thread suggesting READ EVENTS should be your goal. It is the most reliable way to get your events when you expect them.

I suggest using the Coverage Profiler and PortMon to check the flow of events in your app to get a better understanding of what it is really doing.
Previous
Reply
Map
View

Click here to load this message in the networking platform