Results 1 to 5 of 5

Thread: SendProgress & DataArrived

  1. #1
    Guest

    Angry

    Hello all,

    I've been playing around some more with the winsock control, but I can't get the SendProgress event working satisfactorily..

    The code below will not run properly, when I run it, I believe something like this happens:
    1) VB goes through SendProgress
    2) VB then goes to DataArrival
    3) Now the problem is like as though VB goes through DataArrived again, but this time GetData is empty. What causes it to be empty? If SendProgress did not exist, the program runs fine and only goes through DataArrival once. (I know this because I put MsgBox data to see what was received, it received fine, but it unexpectedly showed up a second time with nothing, which caused an error in my parsing code)

    Code:
    Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
        Dim total As Long
        total = Len(fullsend) 'fullsend is the msg that is sent
        frmSending.ProgressBar1.Max = total
        frmSending.Visible = True
        frmSending.ProgressBar1.Value = bytesSent
    End Sub
    
    'and on a separate form, with a separate winsock1
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
        Dim fullmsg As String
        Winsock1.GetData fullmsg
        'alot of parsing code here
    End Sub
    Right now, my temporary solution is:
    Code:
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
        Dim fullmsg As String
        Winsock1.GetData fullmsg
        If fullmsg <> "" Then
           'alot of parsing code here
        End If
    End Sub
    Although I have a solution, I'd really like to know what is causing this, and a proper way around it. MSDN didn't mention anything related to this..


    Thanks
    Sunny

  2. #2
    Guest
    I have same thing happen to me so I didnt use that event either I just went around it.. I think those events are meant only for Client to Client(UDP) and not Server To Client(Tcp/ip)

  3. #3
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219
    Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim FullMsg as String
    Call Winsock1.GetData(FullMsg,Vbstring,bytesTotal)

    If FullMsg = "" then
    msgbox("No Data")
    End If
    End Sub
    me

  4. #4
    Addicted Member
    Join Date
    Jul 1999
    Posts
    219
    i forgot to put the code thing

    Code:
     
     Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) 
    Dim FullMsg as String 
    Call Winsock1.GetData(FullMsg,Vbstring,bytesTotal) 
    
    If FullMsg = "" then 
    msgbox("No Data") 
    End If 
    End Sub
    me

  5. #5
    Guest

    Question

    How does that code above do anything different? (or than telling us theres no data) or solve the problem that SendProgress has?

    Sunny

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