a i have a existing project here, it's a Cafe management for computer shops..
my problem is with the connection..
when is try to send a packet to the client..
the client wont react...
i dont know if the client side just cant receive the packets the server send..
or
the server didn't send the packet properly..
i been trouble with this for days..
since.. i cant detect the problem..
here the code for the send-button on the server side
Private Sub imgComputingG_Click(Index As Integer)
Dim stSQL As String
Dim stTimeIn As String
On Error GoTo Err_Handling
If MsgBox("Start Unit#" & lblUnitNo(Index).Caption & " Timer?", vbQuestion + vbYesNo, "Start Timer") = vbYes Then
Screen.MousePointer = vbHourglass
'bypass
Sock.RemoteHost = "PC4" 'UnitPanel(Index).Tag
Sock.SendData "1"
stTimeIn = Format$(Now, "mm/dd/yyyy hh:mm ampm")
stSQL = "UPDATE UnitLocStats set Status = 'A',"
stSQL = stSQL & " StartDateTime = #" & stTimeIn & "#"
stSQL = stSQL & " Where Unit = " & Str2Fld(lblUnitNo(Index).Caption)
gDB.Execute stSQL
lblUnitNo(Index).ForeColor = vbWhite
lblDateCaption(Index).ForeColor = vbCyan
lblStartTime(Index).ForeColor = vbWhite
lblStartTime(Index).Caption = stTimeIn
imgComputing(Index).PictureAnimationEnabled = True
imgComputing(Index).Visible = True
imgComputingG(Index).Visible = False
UnitPanel(Index).Refresh
Screen.MousePointer = vbDefault
End If
Exit Sub
Err_Handling:
Screen.MousePointer = vbDefault
If Err.Number = 438 Or Err.Number = 10014 Then
MsgBox "Workstation currently unavailable ...", vbInformation, "Unavailable"
Else
MsgBox Err.Number & " - " & Err.Description & "...", vbInformation, "Error Encountered"
End If
End Sub
and here's for the client side
Private Sub Form_Load()
Dim stCompName As String
Dim stHostComputer As String
Dim stHostPath As String
Dim stStatus As String
Dim stStartTime As String
Dim lMins As Long
Left = 0
Top = 0
Sock.RemoteHost = GetSetting(App.Title, "Settings", "HostComputer", "SNAKE-EYES")
Sock.RemotePort = 1001
Sock.Bind 1002
stCompName = GetSetting(App.Title, "Settings", "ComputerName", vbNullString)
stHostComputer = GetSetting(App.Title, "Settings", "HostComputer", vbNullString)
stHostPath = GetSetting(App.Title, "Settings", "DBPath", "C:\Projects\TMS\TMS.MDB")
If stCompName = vbNullString Or stHostComputer = vbNullString Or stHostPath = vbNullString Then
frmSettings.Show vbModal
End If
stStatus = GetSetting(App.Title, "Settings", "Status", "Locked")
stStartTime = GetSetting(App.Title, "Settings", "StartTime", vbNullString)
If stStatus = "Locked" Then
Call LockWorkStation
Else
lMins = CLng((Now - CDate(stStartTime)) * 1440)
If lMins >= 60 Then
mbyHrs = CByte(lMins / 60)
mbyMins = lMins Mod 60
mbySecs = 0
Else
mbyMins = lMins
End If
Timer1.Enabled = True
End If
End Sub
Private Sub Sock_DataArrival(ByVal bytesTotal As Long)
Dim stData As String
On Error GoTo Err_Handler
Sock.GetData stData
Select Case Mid(stData, 1, 1)
Case "0" 'Lock Workstation and Stop Timer
Timer1.Enabled = False
Call LockWorkStation
Call SaveSetting(App.Title, "Settings", "Status", "Locked")
Case "1" 'Unlock Workstation and Start Timer
Call UnlockWorkStation
Call Reset
Call SaveSetting(App.Title, "Settings", "Status", "Unlocked")
Call SaveSetting(App.Title, "Settings", "StartTime", Now)
Case "2" 'Confirm Order
MsgBox "Thankyou !!! Your Order(s) and Message have been received...", vbInformation, "Orders Confirmed"
Unload frmMenuToday
Case "3" 'Message
cmdOrder.PlaySoundFile "Notice.wav"
MsgBox Mid$(stData, 2), vbInformation + vbOKOnly, "Message from Counter"
Case "4" 'Lock Workstation w/o stopping Timer Settings
Call LockWorkStation
Case "5" 'Unlock Workstation w/o stopping Timer Settings
Call UnlockWorkStation
Case "6" 'Shutdown Workstation
Call ShutdownWorkstation
End Select
Exit Sub
Err_Handler:
Screen.MousePointer = vbDefault
MsgBox Err.Number & " - " & Err.Description & " ...", "Error Encountered"
End Sub
pls help me