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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delayed update over network problem 1

Status
Not open for further replies.

alfalf

Programmer
Mar 6, 2003
155
BA
Hello all.

I developed an application that is distributed over network.

Application checks if network connection to server is present and then it adjusts it's behaviour -> Server or Local Save, with my pretty advanced code :):

Code:
Public Function checkLink_M() As Integer
'Returns 1 - link is OK, 2 - physical (hardware)interruption, 3 - application (coding error) interruption
'connDBMAIN is Public Link

Dim rs As DAO.Recordset

If Not (connDbMAIN Is Nothing) Then 'ldb is existing
On Error GoTo err_conn_2
Set rs = connDbMAIN.OpenRecordset("SER_SYS_LINK")
rs.MoveFirst
rs.Edit
rs!link = 1
rs.Update
rs.Close
'CONN IS OK, NO ERRORS triggered
checkLink_M = 1
Else
'SOFTWARE Error - code colapsed ldb
checkLink_M = 3
End If

Set rs = Nothing

EXIT_F:
Exit Function

err_conn_2:
Set rs = Nothing
'HARDWARE COLAPSED PHYSICAL CONNECTION (cable unplugged, disk errors, network failiures, network disabled, Server crushed,...)
checkLink_M = 2
Resume EXIT_F

End Function

Now, this all works fine, but one thing:
That is following problem -> If on Workstation I choose to disable network connection via Network Connections -> Select LAN and Disable it, this should behave as 'HARDVARE FAILIURE' AND RETURN 2. But, instead of that, this rs.update to check if server DB is accessible only, remains in memory as DELAYED UPDATE, and it returns 1 (connection OK).

Frankly, I never heard of such thing.

Therefore, my code doesn't work as it should, in case when network connection is purpously disabled.

Can anyone help me with any idea?
Thanks.
 
Two thoughts.

1) Check the DAO model and see if you can turn off "DELAYED UPDATE" when you open the DAO recordset or DB connection.

2) Use a routine like the one(s) contained in thread705-900140 to check for the existence of an IP address before continuing with your routine.

Hope this nudges in the right direction.
 
Hey CautionMP, I rarely do this, but this time is 100% deserved! You've earned Yourself a Star.

Yap, It didn't cross my mind to check out DAO. And there's solution, pretty simple:
Code:
rs.Update dbUpdateRegular

This way (as Delay is setup by default to True in Update Method), no writting to cache occures, only to disk directly.

You know, I found a lot of code written, some complex API calls provoked, and some damn heavy stuf arround about checking if network PC is available (everyone is barking that's fastest), but trust me, this one above is fast as hell! It rocks, and rocks way over anyones coding, partly thanks to You.

And also, if my code somewhere break down link (instead of for example hardware), I will know.

I provoked every physical situation in real, that can occure over network, and this one (disabling network connection localy in purpouse by user & DELAYED Update) took my nerves out of order.

Pinging other computer is slow result. I needed something simple and fast, which is described above. Since my app. is usually connected to one server, why not use more simple methods. I also tried to do it with winsock, but that made thing only more complicated.

Man am I happy!
Thanks, again, a lot, for the Tip! :-D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top