Page 2 of 2 FirstFirst 12
Results 41 to 48 of 48

Thread: VB6 - NewSocket 2.5

  1. #41
    Lively Member
    Join Date
    Apr 2009
    Posts
    73

    Re: VB6 - NewSocket 2.5

    Found 2 bugs in the NewSocket 2.5

    Code:
    Call Socket.Accept(requestId)
    You had the m_bInEncr flag incorrect thats why a DataArrival event never triggered for me.

    Code:
        If clsSocket.BytesReceived > 0 Then
            'mWinSock.Subclass_ChangeOwner requestId, ObjPtr(Me) 'lol I tried to fix it
            'RaiseEvent DataArrival(clsSocket.BytesReceived) 'lol I tried to fix it
            clsSocket.RecoverData
        End If
        mWinSock.Subclass_ChangeOwner requestId, ObjPtr(Me)
        If GetbSize(m_bRecvBuffer) > 0 Then
            If m_blnEncr Then
                RaiseEvent EncrDataArrival(GetbSize(m_bRecvBuffer))
            Else
                RaiseEvent DataArrival(GetbSize(m_bRecvBuffer))
            End If
        End If
    you had

    Code:
        If clsSocket.BytesReceived > 0 Then
            'mWinSock.Subclass_ChangeOwner requestId, ObjPtr(Me)  'lol I tried to fix it
            'RaiseEvent DataArrival(clsSocket.BytesReceived)  'lol I tried to fix it
            clsSocket.RecoverData
        End If
        mWinSock.Subclass_ChangeOwner requestId, ObjPtr(Me)
        If GetbSize(m_bRecvBuffer) > 0 Then
            If m_blnEncr Then
                RaiseEvent DataArrival(GetbSize(m_bRecvBuffer))
            Else
                RaiseEvent EncrDataArrival(GetbSize(m_bRecvBuffer))
            End If
        End If

    Bug 2, Replace all
    Code:
    m_bData
    with
    Code:
    m_bRecvBuffer

    I think I broke it i'm getting DataArrivals at 0 bytes. haha
    Attached Files Attached Files
    Last edited by pkedpker; Mar 17th, 2020 at 07:23 AM.

  2. #42

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,477

    Re: VB6 - NewSocket 2.5

    NewSocket was replaced long ago by SimpleSock & SimpleServer.

    http://www.vbforums.com/showthread.p...B6-Simple-Sock

    J.A. Coutts

  3. #43
    New Member
    Join Date
    May 2020
    Posts
    5

    Re: VB6 - NewSocket 2.5

    hello, I found that the newsocket2.5 had a bug in mWinsock.bas.
    please take a look,when I send some big data with the size > 65536,I found the send buf was incorect.
    Code:
    Public Function DeleteByte(bArray1() As Byte, ByVal lLen As Long) As Boolean
        Dim lLen1 As Long
        Dim bTmp() As Byte
        lLen1 = GetbSize(bArray1)
        If lLen1 > lLen Then
            ReDim bTmp(lLen1 - lLen - 1)
            CopyMemory bTmp(0), bArray1(lLen-1), lLen1 - lLen' should be CopyMemory bTmp(0), bArray1(lLen), lLen1 - lLen
        End If
        bArray1 = bTmp
    End Function

  4. #44

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,477

    Re: VB6 - NewSocket 2.5

    Quote Originally Posted by lowe517 View Post
    hello, I found that the newsocket2.5 had a bug in mWinsock.bas.
    please take a look,when I send some big data with the size > 65536,I found the send buf was incorect.
    See post #42. NewSocket is no longer supported.

    J.A. Coutts

  5. #45
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: VB6 - NewSocket 2.5

    Quote Originally Posted by couttsj View Post
    See post #42. NewSocket is no longer supported.

    J.A. Coutts
    You should probably note that in Post #1.
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  6. #46
    New Member
    Join Date
    May 2023
    Posts
    9

    Re: VB6 - NewSocket 2.5

    Hallo
    Ich habe ein Problem bei NewSocket (bei NewSocket 2.5 ist es genau so)
    Die Funktion GetIPFromHost benutzt die API GetAddrInfo.

    Solange ich ein gültiger Name übergebe liefert der Server sehr schnell die richtige IP dazu.
    Ist nun der Name aber dem Server nicht bekannt antwortet er nicht und die Funktion GetAddrinfo hat hier wirklich einen ewig langen Timeout den man leider nicht verstellen kann.
    Es gibt alternativ die Funktion API gethostbyname diese hat das Timeout Problem nicht , bzw. er ist kurz genug die API kann aber leider nur IPV4. Ich brauche aber IPV4 und IPV6.
    Wenn ich das richtig recherchiert habe, ist die einzige Abhilfe statt GetAddrinfo die API GetAddrnfoExA zu verwenden. Leider ist diese viel komplexer als die Getaddrinfo so das es mir nicht gelungen ist die Funktion GetIPFromHost entsprechend abzuändern . jemand eine Idee?

  7. #47
    New Member
    Join Date
    May 2023
    Posts
    9

    Re: VB6 - NewSocket 2.5

    Hello
    I have a problem with NewSocket (same with NewSocket 2.5)
    The GetIPFromHost function uses the GetAddrInfo API.

    As long as I pass a valid name, the server supplies the correct IP very quickly.
    If the name is not known to the server, it does not respond and the GetAddrinfo function really has an extremely long timeout here, which unfortunately cannot be changed.
    Alternatively, there is the function API gethostbyname, this does not have the timeout problem, or it is short enough, but unfortunately the API can only do IPV4. But I need IPV4 and IPV6.
    If I researched this correctly, the only workaround is to use the GetAddrnfoExA API instead of GetAddrinfo. Unfortunately, this is much more complex than Getaddrinfo, so I didn't manage to change the GetIPFromHost function accordingly. someone an idea?

  8. #48

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2012
    Posts
    1,477

    Re: VB6 - NewSocket 2.5

    Quote Originally Posted by MatthiasMatthias View Post
    Hello
    I have a problem with NewSocket (same with NewSocket 2.5)
    The GetIPFromHost function uses the GetAddrInfo API.

    As long as I pass a valid name, the server supplies the correct IP very quickly.
    If the name is not known to the server, it does not respond and the GetAddrinfo function really has an extremely long timeout here, which unfortunately cannot be changed.
    Alternatively, there is the function API gethostbyname, this does not have the timeout problem, or it is short enough, but unfortunately the API can only do IPV4. But I need IPV4 and IPV6.
    If I researched this correctly, the only workaround is to use the GetAddrnfoExA API instead of GetAddrinfo. Unfortunately, this is much more complex than Getaddrinfo, so I didn't manage to change the GetIPFromHost function accordingly. someone an idea?
    Besides the fact that NewSocket has long ago been replaced by SimpleSock/SimpleServer and is no longer supported, anything that requires a DNS response is going to take a long time to respond to an invalid request. The default is 15 seconds for each DNS server you have configured. The way around that is to implement your own timeout timer.

    J.A. Coutts

Page 2 of 2 FirstFirst 12

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