Results 1 to 9 of 9

Thread: Winsock not sending data sometimes, but it is others

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Winsock not sending data sometimes, but it is others

    I've had a topic like this before, and numerous Winsock problems. I feel like I know what I am doing, and clearly when something works once it shant work again!

    Anywho, I've been doing some more progress on my project. Here are a couple of examples of working senddata:

    Code:
    Case "move"
                        For i = 0 To lstUsers.ListCount - 1
                            If lstUsers.List(i) = ParamData(0) Then
                                UserIndex = i
                                Exit For
                            End If
                        Next
                        lstX.List(UserIndex) = ParamData(1)
                        lstY.List(UserIndex) = ParamData(2)
                        lstAction.AddItem "move: " & ParamData(0) & " to " & ParamData(1) & "," & ParamData(2)
                        For i = ws.lbound To ws.Ubound
                            SendCommand "move", ParamData(0) & "," & ParamData(1) & "," & ParamData(2), i
                        Next i
                    Case "chat"
                        lstChat.AddItem "[" & ParamData(0) & "] " & ParamData(1), 0
                        For i = ws.lbound To ws.Ubound
                            SendCommand "chat", ParamData(0) & "," & ParamData(1), i
                        Next i
    Here is where I am having a problem:

    Code:
    Case "map"
                        If rsMysql.State = adStateOpen Then
                            rsMysql.Close
                        End If
                        MsgBox CommandData(0) & "," & CommandData(1)
                        rsMysql.Open "SELECT * FROM maps WHERE id = '" & CommandData(1) & "'", cnMysql, adOpenForwardOnly, adLockReadOnly, adCmdText
                        If rsMysql.RecordCount > 0 Then
                            Dim strMap As String, strTemp As String, curStep As Integer: strMap = rsMysql.Fields(2).Value & "end"
                            Do While Len(strMap) > 0
                                curStep = curStep + 1
                                If Len(strMap) < 100 Then
                                    strTemp = strMap
                                    strMap = Replace(strMap, strTemp, "")
                                Else
                                    strTemp = Left$(strMap, 100)
                                    strMap = Replace(strMap, strTemp, "")
                                End If
                                SendCommand "map", strTemp & "," & curStep, i
                            Loop
                        Else
                            SendCommand "map", "Error!", i
                        End If
    My SendCommand function:

    Code:
    Private Sub SendCommand(sCommand As String, params As String, Index As Integer)
        If ws(Index).State = sckConnected Then
            ws(Index).SendData sCommand & "|" & params & "¶"
        End If
    End Sub
    The receiving end is not getting anything, and I have done lots of checking on this. After the senddata, I had an SendComplete sub put up a MsgBox when the data was sent. It worked for the first two cases I showed you, but with this case it did not show. Is there something simple I am just overlooking?

    <3Your Winsock nub,

    thejurm

  2. #2
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Winsock not sending data sometimes, but it is others

    My first suggestion in such cases is always the same: make sure you are using VB6 SP6.

    The Winsock control was given many improvements over the years, especially in cases where multiple Winsocks are being used.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Re: Winsock not sending data sometimes, but it is others

    I am using the latest controls and have updated VB6 as far as I can

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Winsock not sending data sometimes, but it is others

    SendComplete does not mean everything was sent. When it occurs the Winsock control is saying "I have more room in my output buffer for another SendData call."

    However if it is not happening that would seem to indicate that the other end is not taking its input. When the input buffer there fills up TCP will "push back" and prevent the sender from passing any more data over the wire.

    Not getting SendComplete would seem to indicate that the receiver is very slow or hung.


    Are you sure you have VB6 SP6? This still sounds like one of the problems fixed somewhere along the way from SP5 to SP6.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Re: Winsock not sending data sometimes, but it is others

    I'm attempting to update to SP6 again, but I keep getting the error that it did not install successfully? I am using the download from Microsoft's website

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Re: Winsock not sending data sometimes, but it is others

    Alright, here's an update: Total reinstall, updated to SP6. Still having the same issue.

  7. #7
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: Winsock not sending data sometimes, but it is others

    The receiving end, is it one of your programs ? maybe there is something wrong with that program ?

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Re: Winsock not sending data sometimes, but it is others

    What would be wrong that makes it not receive the data on that end from one part only?

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Dec 2008
    Posts
    70

    Re: Winsock not sending data sometimes, but it is others

    Bump, please help

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