Results 1 to 11 of 11

Thread: Winsock connect And Send Issue :(

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    4

    Exclamation Winsock connect And Send Issue :(

    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
    Last edited by Hack; Apr 7th, 2013 at 11:37 AM. Reason: Added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width