I am trying to get to grips with winsock (I feel it is about time).
I have create a client and put the connect, send and close commands behind different button click events and it works fine, but when i come to try to do it behind one click event no data is sent. I don’t get any errors but no data is sent to the server app.
Any suggestions please.
VB Code:
Private Sub Command1_Click() Dim count As Integer Dim iData(1 To 4096) As Byte Dim J As Long Dim InputLength As Long If winsock1.State <> sckClosed Then winsock1.Close winsock1.Connect iData(1) = 1 iData(2) = 4 iData(3) = 0 iData(4) = 4 iData(5) = 0 iData(6) = 2 iData(7) = 48 iData(8) = 10 Do Until winsock1.State = sckConnected DoEvents: DoEvents: DoEvents: DoEvents If winsock1.State = sckError Then MsgBox "No connection" Exit Sub End If Loop For J = 1 To 8 winsock1.SendData (iData(J)) Next winsock1.Close End Sub




Reply With Quote