|
-
Aug 26th, 2007, 03:24 AM
#1
Thread Starter
Lively Member
Reconnecting Winsock
Hi
I've created an internet cafe manager software for my own internet cafe. I created to pieces of program; one for the server and the other one is for the clients. Sometimes I'm having problem with the network connection so I'm planning to add a feature in the client wherein it will reconnect to the server every time it fails to connect. I've tried to use a timer for the client to reconnect whenever a connection with the server doesn't established but I always got an error message.
Sample Code:
In the Form Load
Dim rsClient As New ADODB.Recordset
rsClient.Open "select * from tblClient order by TerminalNo", connClientDB,3,3
Winsock1.RemoteHost = rsClient!IPAddress
Winsock1.RemotePort = rsClient!Port
Winsock1.Connect
rsClient.Close
Set rsClient = Nothing
----------------------------------------------------------------------
In the Timer
Dim rsClient As New ADODB.Recordset
rsClient.Open "select * from tblClient order by TerminalNo", connClientDB,3,3
If Winsock1.State <> sckConnected then
Winsock1.RemoteHost = rsClient!IPAddress
Winsock1.RemotePort = rsClient!Port
Winsock1.Connect
End If
rsClient.Close
Set rsClient = Nothing
To become a PROFESSIONAL,
Start from SCRATCH... 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|