I understand what you are doing, attaching an event handler to the serial port that gets called whenever any data arrives. You handler is declaring a local variable called dataBack which lies in a different scope to that of the public variable also called dataBack so you will never get back anything. Remove the variable type declaration to make the handler use the public variable rather than declaring a new one in its own scope.
Ta, I am now getting the response back that I am expecting - but only if i do;
Code:
System.Threading.Thread.Sleep(6000);
As this is a web service, I guess as soon as this method terminates then the event handler does too.
This might need a rethink, there is no need to do be doing any of this as web services - I can just stick it all on the back of an asp.net page.. i think
hmmmmm...
would there be any controls in asp.net that would allow me to leave the event handler running, and then any data that comes into it - comes straight onto the asp page, without the need for a reload.. AJAX?
Last edited: