I have a server monitoring app that uses a ServerSocket to handle about 30 client connections. These client connections automatically connect to the server app via a timer in the client app every 3 minutes. When the client app connects, the server app logs the client connection in a SQLite database sitting on the computer running the server monitoring app. I am having issues when multiple clients try to connect to the server app at or close to the same time some of the connections are never logged in the SQLite database. I can see the client apps are connecting fine so it’s not a socket issue. I currently have the ServerSocket set to 50 min 255 max. I moved all of the database methods and any properties or other methods that are used during the logging process into private methods/properties of the ServerSocket. This didn’t solve my issue. Is this a limitation in SQLite? Any advice would be appreciated.
The code that logs the client connection to the SQLite database.
[code]Dim strScanDate As String
Dim Now As New Date
strScanDate = Now.SQLDateTime
Dim dbFile as FolderItem
Dim db as SQLiteDatabase
db=New SQLiteDatabase
dbFile = getDBFile
db.DatabaseFile=dbFile
//sets the encryption key
db.encryptionKey = kEk
If db.Connect() then
Dim ps As SQLitePreparedStatement = db.prepare("Insert into tLogCount (GName, GIP, GMAC, GScanDate, Status) " +_
“Values(?, ?, ?, ?, ?)”)
ps.BindType(0, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(1, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(2, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(3, SQLitePreparedStatement.SQLITE_TEXT)
ps.BindType(4, SQLitePreparedStatement.SQLITE_TEXT)
ps.SQLExecute(strName, strIP, strMAC, strScanDate, “1”)
db.Commit
else
’ Error handling
end if
db.Close[/code]
I have a property in the ServerSocket called myDBFile which is type SQLiteDatabase. This is the method getDBFile from the code above:
[code] // Create database object
myDBFile = New SQLiteDatabase
myDBFile.databaseFile = GetFolderItem(strConfigLocation)
return myDBFile.databaseFile[/code]