This isn't about "network programming" per say, but about how to handle the issue that arises when a client is running an application located on a server and the network connection goes down temporarily.
My background is in .Net. And my understanding is that if I run an application located on another machine, then the .exe from the remote machine is loaded into memory on the client machine... which means that, in .Net, I could catch an exception when the network goes down and handle it.
I don't know much about Clarion yet, but there is a Point Of Sale system I use that always crashes when the network goes down that's written in Clarion. The programmer assures me that when the network goes down that I am no longer connected to their application which resides on the server (I disagree with this because as mentioned before, I believe the application is already in memory on the client.)
Can this problem be handled in a Clarion application, and more importantly if so then how might you go about handling it?
EDIT: Also, I can see how there might be an issue if a particular dll that hasn't been loaded into memory yet is being accessed but for the purposes of this question assume that this isn't the case. I can make this issue happen virtually anytime I want by unplugging the network cable so I'm pretty confident that this isn't the issue (or at least not 99% of the time).
The application may be in memory on the client, but the data connection could be lost when the network fails. If that's not handled in code, the client could definitely crash. NetTalk, while fantastically robust, may not be what you're looking for in this situation.
After any Get
, Set/Next
, Add
, Put
, etc., you should be checking for errors:
Get(File, Key)
IF ErrorCode()
!Show error message and ask to retry, etc.
Message('Error '&ErrorCode()&' - '&Error())
End
You can also check FileError()
which will give you more detailed information on file related errors.