Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42299

Winsock connect And Send Issue :(

$
0
0
Hey all

I'm Trying to connect With Winsock and Send Data With One Command
I have problem to do that becouse the state connection is 6 when he try to send data
i try to put delay timer but its not work, i alsow try to use loop and the app get stuck What can i do to Soulve This :( ?
Code:

Private Sub CmdAuto_Click()
Dim iNumber As Integer
Dim xxx As Integer
Dim str As String

Dim sSpilt
iNumber = 1
lblCaseStep.Caption = iNumber
txtSend.Text = ""

'For xxx = 1 To 100 Step 1
    Select Case iNumber
      Case 1
           
            sockMain.RemoteHost = "127.0.0.1" '"169.254.11.22"
            sockMain.RemotePort = 12345 '2000
            sockMain.Connect
            'Sleep 1000
            'Delay 5
            iNumber = 5
            lblCaseStep.Caption = iNumber
           
      Case 5
     
            If sockMain.State = 7 Then
                iNumber = 10
                lblCaseStep.Caption = iNumber
            End If
           
      Case 10
        lblCaseStep.Caption = iNumber
          Open FilePath.Text For Input As #1
          Do While Not EOF(1)
                Line Input #1, str
                Text1.Text = Text1.Text & str & vbCrLf
                sSpilt = Split(str, ":")
                If sSpilt(0) = "Length" Then
                    txtLength.Text = sSpilt(1)
                ElseIf sSpilt(0) = "Quantity" Then
                    txtQuntity.Text = sSpilt(1)
                End If
            Loop
            If EOF(1) Then
                txtSend.Text = txtLength.Text & vbCrLf & txtQuntity.Text
                iNumber = 15
                Close #1
            End If
        Case 15
            sockMain.SendData "111"
            iNumber = 20
    End Select
    Delay 1
'Next xxx
End Sub


Viewing all articles
Browse latest Browse all 42299

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>