J
Jim Franklin
Hi,
I have a client application which is communicating with a server, sending
and receiving xml strings using the Winsock control. I am using Access 2003
and Win XP.
I have several different bits of code to generate the various commands I
need to send, but one procedure ProcessXML in a standard module which
connects to the Winsock control, sends the command and then processes the
response received. I have global variables in this code and one Winsock
control open on a hidden form.
My problem is that there are several different events running simultaneously
which may try to communicate with the Winsock and I am concerned about one
area of my application trying to run ProcessXML when it is already mid-way
through processing a previous communication. For example, one form updates
itsself using the OnTimer event to periodically request the latest
information from the server application, but the user can manually at any
time send other commands. Is there any way of suspending execution of
ProcessXML if it is already running, either until it has finished, or
waiting a set amount of time before trying again?
I did think about having some sort of global variable, say blBusy which I
test for at the start of the procedure using a Do...Loop and set to true
while it is running, but this seems very inefficient and I would have
thought will cripple performance.
e.g.
Do Until blBusy = False
Loop
blBusy = True
...run all the procedure code
blBusy = False
Is there a better way of doing it than this? Is DoEvents any use to me?
I hope all this makes sense! Many many thanks for any advice and pointers
anyone
can provide!!
Jim
I have a client application which is communicating with a server, sending
and receiving xml strings using the Winsock control. I am using Access 2003
and Win XP.
I have several different bits of code to generate the various commands I
need to send, but one procedure ProcessXML in a standard module which
connects to the Winsock control, sends the command and then processes the
response received. I have global variables in this code and one Winsock
control open on a hidden form.
My problem is that there are several different events running simultaneously
which may try to communicate with the Winsock and I am concerned about one
area of my application trying to run ProcessXML when it is already mid-way
through processing a previous communication. For example, one form updates
itsself using the OnTimer event to periodically request the latest
information from the server application, but the user can manually at any
time send other commands. Is there any way of suspending execution of
ProcessXML if it is already running, either until it has finished, or
waiting a set amount of time before trying again?
I did think about having some sort of global variable, say blBusy which I
test for at the start of the procedure using a Do...Loop and set to true
while it is running, but this seems very inefficient and I would have
thought will cripple performance.
e.g.
Do Until blBusy = False
Loop
blBusy = True
...run all the procedure code
blBusy = False
Is there a better way of doing it than this? Is DoEvents any use to me?
I hope all this makes sense! Many many thanks for any advice and pointers
anyone
can provide!!
Jim