亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? csocket.cls

?? 簡單、實用、特別。 有很多不足之處
?? CLS
?? 第 1 頁 / 共 4 頁
字號:
            '
            'A value of SOCKET_ERROR means that the socket was not created.
            'In this case the SocketExists function must return False
            Exit Function '>---> Bottom
            '
          Else 'NOT M_LNGSOCKETHANDLE...
            '
            'Get default size of the Winsock's buffers.
            Call GetWinsockBuffers  'Modified: 10-MAR-2002
            '
        End If
        '
    End If
    '
    'The m_lngSocketHandle variable contains a valid socket
    'handle value. In this case the function returns True.
    SocketExists = True
    '

End Function

Private Sub GetWinsockBuffers()

  '
  'This subroutine is to retrieve default size of the Winsock buffers.
  'These values will be stored in the module level variables:
  'm_lngSendBufferLen and m_lngRecvBufferLen.
  'It can be called from the SocketExists and Accept functions.
  '
  'Added: 10-MAR-2002
  '

  Dim lngRetValue     As Long 'value returned by the getsockopt Winsock API function
  Dim lngBuffer       As Long 'buffer to pass with the getsockopt call

    '
    If mvarProtocol = sckTCPProtocol Then
        'Buffer for incoming data
        lngRetValue = getsockopt(m_lngSocketHandle, SOL_SOCKET, SO_RCVBUF, lngBuffer, 4&)
        m_lngRecvBufferLen = lngBuffer
        'Buffer for outgoing data
        lngRetValue = getsockopt(m_lngSocketHandle, SOL_SOCKET, SO_SNDBUF, lngBuffer, 4&)
        m_lngSendBufferLen = lngBuffer
      Else 'NOT MVARPROTOCOL...
        'the m_lngMaxMsgSize value is returned by InitWinsockService
        'function from the MSocketSupport module
        m_lngSendBufferLen = m_lngMaxMsgSize
        m_lngRecvBufferLen = m_lngMaxMsgSize
    End If
    '

End Sub

Private Function RecvDataToBuffer() As Long

  '
  'This function is to retrieve data from the Winsock buffer
  'into the class local buffer. The function returns number
  'of bytes retrieved (received).
  '

  Dim lngBytesReceived        As Long     'value returned by recv/recvfrom Winsock API function
  Dim lngRetValue             As Long     'value returned by gethostbyaddr Winsock API function
  Dim strTempBuffer           As String   'just a temporary buffer
  Dim arrBuffer()             As Byte     'buffer to pass to the recv/recvfrom Winsock API function
  Dim udtSockAddr             As sockaddr_in 'socket address of the remote peer
  Dim lngSockAddrLen          As Long     'size of the sockaddr_in structure
  Dim udtHostEnt              As HostEnt  'used to get host name with gethostbyaddr function

    '
    'Prepare the buffer to pass it to the recv/recvfrom Winsock API function.
    'The m_lngRecvBufferLen variable was initialized during creating
    'of the socket, see the vbSocket function to find out how.
    ReDim arrBuffer(m_lngRecvBufferLen - 1)
    '
    If mvarProtocol = sckTCPProtocol Then
        '
        'If the socket is a connection-oriented one, just call the recv function
        'to retrieve all the arrived data from the Winsock buffer.
        lngBytesReceived = recv(m_lngSocketHandle, arrBuffer(0), m_lngRecvBufferLen, 0&)
        '
      Else 'NOT MVARPROTOCOL...
        '
        'If the socket uses UDP, it's another story. As stated in the MS Winsock Control
        'documentation after receiving data the RemoteHost, RemoteHostIP, and RemotePort
        'properties contains parameters of the machine sending the UDP data. To achive
        'such a behavior we must use the recvfrom Winsock API function.
        '
        lngSockAddrLen = Len(udtSockAddr)
        '
        lngBytesReceived = recvfrom(m_lngSocketHandle, arrBuffer(0), m_lngRecvBufferLen, _
                           0&, udtSockAddr, lngSockAddrLen)
        '
        If Not lngBytesReceived = SOCKET_ERROR Then
            '
            'Now the udtSockAddr contains a socket address of the remote host.
            'Initialize the RemoteHost, RemoteHostIP, and RemotePort properties.
            '
            With udtSockAddr
                '
                'RemotePort property
                m_lngRemotePort = IntegerToUnsigned(ntohs(.sin_port))
                'RemoteHostIP property
                m_strRemoteHostIP = StringFromPointer(inet_ntoa(.sin_addr))
                'RemoteHost property
                lngRetValue = gethostbyaddr(.sin_addr, 4&, AF_INET)
                CopyMemory udtHostEnt, ByVal lngRetValue, Len(udtHostEnt)
                m_strRemoteHost = StringFromPointer(udtHostEnt.hName)
                '
            End With 'UDTSOCKADDR
            '
        End If
        '
    End If
    '
    If lngBytesReceived > 0 Then
        '
        'Convert a byte array into the VB string
        strTempBuffer = StrConv(arrBuffer(), vbUnicode)
        'Store received data in the local buffer for incoming data - m_strRecvBuffer
        m_strRecvBuffer = m_strRecvBuffer & Left$(strTempBuffer, lngBytesReceived)
        'Return number of received bytes.
        RecvDataToBuffer = lngBytesReceived
        '
      ElseIf lngBytesReceived = SOCKET_ERROR Then 'NOT LNGBYTESRECEIVED...
        '
        Err.Raise Err.LastDllError, "CSocket.RecvToBuffer", GetErrorDescription(Err.LastDllError)
        '
    End If
    '

End Function

Private Function RecvData(varData As Variant, blnPeek As Boolean, Optional varType As Variant, Optional maxLen As Variant) As Long

  '
  'This function is to retrieve data from the local buffer (m_strRecvBuffer).
  'It can be called by two public methods of the class - GetData and PeekData.
  'Behavior of the function is defined by the blnPeek argument. If a value of
  'that argument is True, the function returns number of bytes in the
  'local buffer, and copy data from that buffer into the varData argument.
  'If a value of the blnPeek is False, then this function returns number of
  'bytes received, and move data from the local buffer into the varData
  'argument. MOVE means that data will be removed from the local buffer.
  '

  Dim strRecvData As String   'temporary string buffer
  Dim arrBuffer() As Byte     'temporary byte array buffer

    '
    'If the local buffer is empty, go away - we have nothing to do here.
    If Len(m_strRecvBuffer) = 0 Then Exit Function ':(燛xpand Structure or consider reversing Condition
    '
    If IsEmpty(maxLen) Then
        maxLen = 0
    End If
    '
    If (Not maxLen > Len(m_strRecvBuffer)) And (maxLen > 0) Then
        '
        strRecvData = Left$(m_strRecvBuffer, CLng(maxLen))
        '
        If Not blnPeek Then
            m_strRecvBuffer = Mid$(m_strRecvBuffer, CLng(maxLen + 1))
        End If
        '
        arrBuffer() = StrConv(strRecvData, vbFromUnicode)
        '
      Else 'NOT (NOT...
        '
        arrBuffer() = StrConv(m_strRecvBuffer, vbFromUnicode)
        '
        If Not blnPeek Then
            m_strRecvBuffer = ""
        End If
        '
    End If
    '
    If IsEmpty(varType) Then
        varData = CStr(StrConv(arrBuffer(), vbUnicode))
      Else 'ISEMPTY(VARTYPE) = FALSE
        '
        Select Case varType
          Case vbArray + vbByte
            'Modified 28-MAY-2002. Thanks to Michael Freidgeim
            '--------------------------------
            'Dim strArray As String
            'strArray = StrConv(arrBuffer(), vbUnicode)
            'varData = StrConv(strArray, vbFromUnicode)
            varData = arrBuffer()
            '--------------------------------
          Case vbBoolean
  Dim blnData As Boolean ':(燤ove line to top of current Function
            CopyMemory blnData, arrBuffer(0), LenB(blnData)
            varData = blnData
          Case vbByte
  Dim bytData As Byte ':(燤ove line to top of current Function
            CopyMemory bytData, arrBuffer(0), LenB(bytData)
            varData = bytData
          Case vbCurrency
  Dim curData As Currency ':(燤ove line to top of current Function
            CopyMemory curData, arrBuffer(0), LenB(curData)
            varData = curData
          Case vbDate
  Dim datData As Date ':(燤ove line to top of current Function
            CopyMemory datData, arrBuffer(0), LenB(datData)
            varData = datData
          Case vbDouble
  Dim dblData As Double ':(燤ove line to top of current Function
            CopyMemory dblData, arrBuffer(0), LenB(dblData)
            varData = dblData
          Case vbInteger
  Dim intData As Integer ':(燤ove line to top of current Function
            CopyMemory intData, arrBuffer(0), LenB(intData)
            varData = intData
          Case vbLong
  Dim lngData As Long ':(燤ove line to top of current Function
            CopyMemory lngData, arrBuffer(0), LenB(lngData)
            varData = lngData
          Case vbSingle
  Dim sngData As Single ':(燤ove line to top of current Function
            CopyMemory sngData, arrBuffer(0), LenB(sngData)
            varData = sngData
          Case vbString
  Dim strData As String ':(燤ove line to top of current Function
            strData = StrConv(arrBuffer(), vbUnicode)
            varData = strData
            '
        End Select
        '
    End If
    '
    'Added 28-MAY-2002. Thanks to Michael Freidgeim
    m_lngBytesReceived = Len(m_strRecvBuffer) 'reset BytesReceived after Getdata
    '

End Function

Private Sub DestroySocket()

  '
  'The purpose of this subroutine is to unregister the socket with
  'UnregisterSocket that can be found in the MSocketSupport module
  'and close the socket with the closesocket Winsock API function.
  '

  Dim lngRetValue As Long 'value returned by the closesocket

    'Winsock AP function
    '
    If Not m_lngSocketHandle = INVALID_SOCKET Then
        '
        'Unregister the socket. For more info on how it works
        'see the code of the function in the MSocketSupport module
        Call MSocketSupport.UnregisterSocket(m_lngSocketHandle)
        '
        'Close the socket with the closesocket Winsock API function.
        lngRetValue = api_closesocket(m_lngSocketHandle)
        '

        '
        If lngRetValue = SOCKET_ERROR Then
            Err.Raise Err.LastDllError, "CSocket.DestroySocket", GetErrorDescription(Err.LastDllError)
        End If
        '
        'Change the SocketHandle property value
        m_lngSocketHandle = INVALID_SOCKET
        '
        'If the bind Winsock API function has been called on
        'this socket, m_blnSocketIsBound = True. We need to
        'change this value.
        m_blnSocketIsBound = False  'Added: 10-MAR-2002
        '
    End If
    '

End Sub

Private Sub Class_Terminate()

  '

    If Not m_lngSocketHandle = INVALID_SOCKET Then
        Call DestroySocket
    End If
    '
    Call CleanupWinsock
    '

End Sub

Private Sub SendBufferedData()

  '
  'This procedure sends data from the local buffer (m_strSendBuffer).
  'The data from the client application is passed with the SendData
  'method of the class as an argument and is stored in the local
  'buffer until all the data from that buffer will be sent using this
  'subroutine.
  '
  'Why do we need to store data in the local buffer? There are some
  'things happenning in the Winsock's buffer for outgoing data since
  'we're using non-blocking sockets' calls. If that buffer is full,
  'the transport subsystem doesn't take the data and the send/sendto
  'functions return a value of SOCKET_ERROR, Err.LastDllError give
  'us a value of WSAEWOULDBLOCK. This means that if the socket would
  'be a blocking one, such a call would block socket until the buffer
  'will be freed and ready to accept some data to send.
  '
  'So this procedure can be called several (mostly not more than two)
  'times for the same chunk of data. First call is in the body of the
  'SendData method, and other calls (if necessary) will be performed
  'from the PostSocketEvent subroutine, as soon as the FD_WRITE message
  'will be received. The arrival of the FD_WRITE message means that a
  'socket is in a write-able state - its buffer is ready to get data.
  '

  Dim lngRetValue     As Long         'value returned by send/sendto Winsock API function
  Dim arrData()       As Byte         'data to send with the send/sendto function
  Dim lngBufferLength As Long         'size of the data buffer to send
  Dim udtSockAddr     As sockaddr_in  'address of the remote socket - for the sendto function

    '
    'The send/sendto function needs this value for one of its arguments
    lngBufferLength = Len(m_strSendBuffer)
    '
    'Convert data from a VB string to a byte array
    arrData() = StrConv(m_strSendBuffer, vbFromUnicode)
    '
    If mvarProtocol = sckTCPProtocol Then
        '
        'just call the send function in order to send data via connection
        lngRetValue = send(m_lngSocketHandle, arrData(0), lngBufferLength, 0&)
        '
      Else 'NOT MVARPROTOCOL...
        '
        'With UDP socket we are going to use the sendto Winsock API function.
        'This function needs the socket address of the remote host to send
        'message to.
        '
        If Len(m_strRemoteHostIP) = 0 Then
            '
            'If the RemoteHostIP property is empty, we don't know
            'the remote IP so we need to resolve that address.
            '
            m_varInternalState = istSendingDatagram
            m_lngRequestID = MSocketSupport.ResolveHost(m_strRemoteHost, ObjPtr(Me))
            '
            'The ResolveHost is an asynchronous call. This subroutine wiil be called
            'one more time from the PostGetHostEvent procedure when the host will be
            'resolved.
            '
          Else 'NOT LEN(M_STRREMOTEHOSTIP)...
            '
            'If we are here the host was resolved successfully and the RemoteHostIP
            'property provides us with IP to send a UDP message to.
            '
            'Build the sockaddr_in structure to pass the remote socket address
            'to the sendto function.
            With udtSockAddr
                .sin_addr = inet_addr(m_strRemoteHostIP)
                .sin_port = htons(UnsignedToInteger(m_lngRemotePort))
                .sin_family = AF_INET
            End With 'UDTSOCKADDR
            '
            'Call the sendto function in order to send a UDP message
            lngRetValue = sendto(m_lngSocketHandle, arrData(0), lngBufferLength, 0&, udtSockAddr, Len(udtSockAddr))
            '
        End If
        '
    End If
    '
    If lngRetValue = SOCKET_ERROR Then
        '
        'If a value of Err.LastDllError is WSAEWOULDBLOCK, that means
        'that the Winsock's buffer for outgoing data is full and cannot
        'accept data to send. In this case we ignore this error and do
        'not empty local buffer (m_strSendBuffer).
        '
        If Not Err.LastDllError = WSAEWOULDBLOCK Then
            Err.Raise Err.LastDllError, "CSocket.SendData", GetErrorDescription(Err.LastDllError)

        End If
        '
      Else 'NOT LNGRETVALUE...
        '
        'The data were sent successfully. Raise the OnSendProgress or
        'OnSendComplete event to let the client app know.
        '

        '
        If Len(m_strSendBuffer) > lngRetValue Then
            '
            m_strSendBuffer = Mid$(m_strSendBuffer, lngRetValue + 1)
            '
          Else 'NOT LEN(M_STRSENDBUFFER)...
            m_strSendBuffer = ""

            RaiseEvent OnSendComplete
        End If
        '
        RaiseEvent OnSendProgress(lngRetValue, Len(m_strSendBuffer))
        '
    End If
    '

End Sub

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
视频一区二区国产| 在线中文字幕不卡| 日本韩国欧美在线| 日韩欧美中文一区| 亚洲一区二区三区四区的| 国产成人综合视频| 9191国产精品| 一区二区三区精品视频在线| 国产乱码精品一品二品| 欧美日韩日日夜夜| 亚洲精品高清在线观看| 国产精品一区久久久久| 日韩亚洲欧美高清| 视频一区中文字幕| 在线日韩一区二区| 亚洲三级在线免费观看| 成人一区二区视频| 久久色.com| 国产一区二区三区四区在线观看| 91精品久久久久久久99蜜桃| 亚洲伊人色欲综合网| 91麻豆产精品久久久久久| 亚洲欧洲日韩在线| 成人免费不卡视频| 中文字幕一区二区三区在线播放 | 欧美怡红院视频| 亚洲国产高清在线| 国产成人一区在线| 国产午夜精品福利| 国产一区二区美女| 欧美精品一区视频| 国产大陆精品国产| 久久精品视频一区二区| 国产精品一二三四| 国产精品视频在线看| 粉嫩av一区二区三区在线播放| 国产亚洲精品久| 国产69精品久久久久毛片| 国产日产欧美一区| 成人性生交大合| 亚洲色图制服诱惑| 欧美性受xxxx| 婷婷成人激情在线网| 欧美一区二区私人影院日本| 另类人妖一区二区av| 欧美精品一区二区三区很污很色的| 麻豆视频一区二区| 国产欧美一二三区| 欧亚一区二区三区| 日韩主播视频在线| 国产婷婷精品av在线| 成人免费电影视频| 亚洲一区二区三区在线播放| 制服丝袜中文字幕亚洲| 国内久久精品视频| 18涩涩午夜精品.www| 欧美午夜电影一区| 美女网站在线免费欧美精品| 国产农村妇女毛片精品久久麻豆| 91视频观看视频| 丝袜诱惑亚洲看片| 久久久久久久综合| 欧美在线色视频| 韩国精品在线观看| 一区二区三区.www| 欧美va在线播放| 日本久久电影网| 美女被吸乳得到大胸91| 欧美激情一区二区| 欧美剧在线免费观看网站| 国产精品系列在线播放| 亚洲成av人片| 国产日韩视频一区二区三区| 欧美性生活久久| 丁香婷婷深情五月亚洲| 日本一道高清亚洲日美韩| 中文字幕一区二区三区在线观看| 91精品久久久久久久91蜜桃| 不卡av在线免费观看| 美女视频第一区二区三区免费观看网站| 国产精品狼人久久影院观看方式| 欧美一区二区三区在线| 一本大道久久a久久精二百| 麻豆一区二区在线| 亚洲自拍偷拍欧美| 国产精品家庭影院| 久久久亚洲高清| 欧美一级电影网站| 欧美在线播放高清精品| 高清国产午夜精品久久久久久| 视频在线观看国产精品| 亚洲裸体xxx| 欧美—级在线免费片| 欧美一区二区视频在线观看2020| 一本大道av一区二区在线播放 | 亚洲国产视频一区二区| 国产精品色眯眯| 国产亚洲精品资源在线26u| 日韩一区二区精品在线观看| 在线欧美一区二区| 色综合久久99| 91片黄在线观看| 成人精品视频一区| 国产成人免费视频精品含羞草妖精| 日韩精品午夜视频| 亚洲成精国产精品女| 伊人婷婷欧美激情| 亚洲最新在线观看| 亚洲欧美日韩国产综合| 亚洲人精品午夜| 18成人在线视频| 亚洲欧美综合色| 国产精品女同互慰在线看| 久久先锋影音av| 国产性做久久久久久| 国产人伦精品一区二区| 久久亚洲精品小早川怜子| 欧美zozozo| 欧美va在线播放| 久久久久久久精| 中文一区一区三区高中清不卡| 国产欧美日本一区视频| 国产精品久久一级| 综合在线观看色| 亚洲激情在线激情| 亚洲午夜影视影院在线观看| 婷婷久久综合九色国产成人| 天堂一区二区在线免费观看| 青草国产精品久久久久久| 久草在线在线精品观看| 激情深爱一区二区| 成人久久18免费网站麻豆| 91麻豆免费视频| 欧美日韩国产一区二区三区地区| 911国产精品| 久久久美女毛片 | 国产欧美一区二区三区鸳鸯浴| 国产日韩精品一区二区浪潮av| 国产精品乱码妇女bbbb| 一区二区三区精品在线| 免费亚洲电影在线| 成人性生交大合| 欧美日韩一区不卡| 久久综合一区二区| 亚洲免费看黄网站| 秋霞午夜av一区二区三区| 国产成人综合在线播放| 91精品91久久久中77777| 欧美电影一区二区| 欧美激情资源网| 婷婷夜色潮精品综合在线| 国产精品综合一区二区| 欧美性xxxxxxxx| 久久众筹精品私拍模特| 亚洲激情六月丁香| 国产精品自拍一区| 在线不卡中文字幕| 国产精品丝袜一区| 麻豆成人91精品二区三区| 99久久免费视频.com| 欧美大肚乱孕交hd孕妇| 中文字幕亚洲一区二区av在线 | 国产精品一区二区91| 欧美性一级生活| 国产精品乱码一区二区三区软件 | 日韩一区二区三区在线观看 | 蜜桃免费网站一区二区三区 | 成熟亚洲日本毛茸茸凸凹| 欧美亚洲尤物久久| 国产片一区二区三区| 美女一区二区三区| 欧美日韩成人一区二区| 国产精品对白交换视频 | 亚洲福利电影网| 丁香激情综合国产| 日韩欧美一二区| 亚洲小说春色综合另类电影| 成人午夜电影网站| xf在线a精品一区二区视频网站| 亚洲成人激情社区| 91女人视频在线观看| 国产亚洲成年网址在线观看| 精品亚洲国产成人av制服丝袜 | 欧美va日韩va| 日韩高清不卡一区| 欧美日韩国产一区二区三区地区| 日韩美女视频一区| 99精品国产热久久91蜜凸| 国产欧美日韩不卡免费| 国产乱码精品1区2区3区| 日韩欧美一级在线播放| 欧美aaaaa成人免费观看视频| 在线观看精品一区| 亚洲日本免费电影| 99久久99久久精品免费观看| 国产精品欧美精品| 91首页免费视频| 一级精品视频在线观看宜春院| 波多野结衣在线一区| 国产精品美女久久久久久久网站|