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

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

?? csocket.cls

?? 簡單、實用、特別。 有很多不足之處
?? CLS
?? 第 1 頁 / 共 4 頁
字號:
    '

End Sub

Public Function vbSocket() As Long

  '********************************************************************************
  'Author    :Oleg Gdalevich
  'Purpose   :Creates a new socket
  'Returns   :The socket handle if successful, otherwise - INVALID_SOCKET
  'Arguments :
  '********************************************************************************
  '

    On Error GoTo vbSocket_Err_Handler
    '
  Dim lngRetValue     As Long 'value returned by the socket API function':(燤ove line to top of current Function
    '
    'Call the socket Winsock API function in order to create a new socket
    If mvarProtocol = sckUDPProtocol Then
        lngRetValue = api_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
      Else 'NOT MVARPROTOCOL...
        lngRetValue = api_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
    End If
    '
    If lngRetValue = INVALID_SOCKET Then
        '
        Err.Raise Err.LastDllError, "CSocket.vbSocket", GetErrorDescription(Err.LastDllError)
        '
      Else 'NOT LNGRETVALUE...
        '

        '
        If MSocketSupport.RegisterSocket(lngRetValue, ObjPtr(Me)) Then
            '
            'Assign returned value
            vbSocket = lngRetValue
            '
          Else 'NOT MSOCKETSUPPORT.REGISTERSOCKET(LNGRETVALUE,...
            '
            'Err.Raise Err.LastDllError, "CSocket.vbSocket", GetErrorDescription(Err.LastDllError)
            '
        End If
        '
    End If
    '
EXIT_LABEL:

Exit Function

vbSocket_Err_Handler:
    '
    vbSocket = INVALID_SOCKET
    '

End Function

Friend Sub PostSocketEvent(ByVal lngEventID As Long, Optional ByVal lngError As Long)

  '
  'This procedure is called by the WindowProc callback function
  'from the MSocketSupport module. The lngEventID argument is an
  'ID of the network event occurred for the socket. The lngError
  'argument contains an error code only if an error was occurred
  'during an asynchronous execution.
  '

  Dim lngBytesReceived    As Long         'value returned by the RecvDataToBuffer function
  Dim lngRetValue         As Long         'value returned by the getsockname Winsock API function
  Dim lngNewSocket        As Long         'value returned by the accept Winsock API function
  Dim udtSockAddr         As sockaddr_in  'remote socket address for the accept Winscok API function
  Dim udtHostEnt          As HostEnt      'structure to hold the host info - returned

    '                                        by the gethostbyaddr Winsock API function
    '
    On Error GoTo ERROR_HANDLER
    '
    If lngError > 0 Then
        '
        'An error was occured.
        '
        'Change a value of the State property
        mvarState = sckError

        'Close the socket
        Call DestroySocket
        'The OnError event is just for this case
        RaiseEvent OnError(CInt(lngError), GetErrorDescription(lngError), 0, "", "", 0, False)
        'We have nothing to do here anymore
        Exit Sub '>---> Bottom
        '
    End If
    '
    Select Case lngEventID
        '
      Case FD_READ
        '

        '
        'Some data has arrived for this socket.
        'Call the RecvDataToBuffer function that move arrived data
        'from the Winsock buffer to the local one and returns number
        'of bytes received.
        lngBytesReceived = RecvDataToBuffer
        '

        '
        'The BytesReceived property contains number of bytes in
        'the local buffer of the class.
        m_lngBytesReceived = m_lngBytesReceived + lngBytesReceived
        '
        'The OnDataArrival event is just for the case when some data
        'was retieved from the Winsock buffer.
        If lngBytesReceived > 0 Then
            RaiseEvent OnDataArrival(Len(m_strRecvBuffer))
        End If
        '
      Case FD_WRITE
        '
        'This message means that the socket in a write-able
        'state, that is, buffer for outgoing data of the transport
        'service is empty and ready to receive data to send through
        'the network.
        '

        '
        'If the local buffer for outgoing data (m_strSendBuffer) is
        'not empty, the previous call of the send/sendto Winsock API
        'function was failed. Call the SendBufferedData procedure in
        'oreder to try to send that data again.
        If Len(m_strSendBuffer) > 0 Then
            '
            Call SendBufferedData
            '
        End If
        '
      Case FD_OOB
        '
        'Ignored.
        '
      Case FD_ACCEPT
        '
        'When the socket is in a listening state, arrival of this message
        'means that a connection request was received. Call the accept
        'Winsock API function in oreder to create a new socket for the
        'requested connection.
        lngNewSocket = api_accept(m_lngSocketHandle, udtSockAddr, Len(udtSockAddr))
        '

        '
        'Let the client application know that the request was received
        'and pass with the event argument a handle of the recently created
        'socket. The client application should create a new instance of
        'the CSocket class, and then use the socket handle (lngNewSocket)
        'to initialize its properties. Another way is to do not create
        'one more instance of this class. We may close existing socket,
        'and then accept the new handle:
        '
        '  Private Sub objSocket_OnConnectionRequest(ByVal requestID As Long)
        '      If objSocket.State <> sckClosed Then objSocket.CloseSocket
        '      objSocket.Accept (requestID)
        '  End Sub
        '
        RaiseEvent OnConnectionRequest(lngNewSocket)
        '
      Case FD_CONNECT
        '
        'Arrival of this message means that the connection initiated by the call
        'of the connect Winsock API function was successfully established.
        '
        'Get the connection local end-point parameters
        '
        lngRetValue = getsockname(m_lngSocketHandle, udtSockAddr, LenB(udtSockAddr))
        '
        If lngRetValue = 0 Then
            '
            'LocalPort property
            m_lngLocalPort = IntegerToUnsigned(ntohs(udtSockAddr.sin_port))
            'LocalIP property
            m_strLocalIP = StringFromPointer(inet_ntoa(udtSockAddr.sin_addr))
            'LocalHostName property
            lngRetValue = gethostbyaddr(udtSockAddr.sin_addr, 4&, AF_INET)
            CopyMemory udtHostEnt, ByVal lngRetValue, Len(udtHostEnt)
            m_strLocalHostName = StringFromPointer(udtHostEnt.hName)
            '
        End If
        '
        ' -- Modified: 04-MAR-2002 --
        '
        'Change a value of the State property
        mvarState = sckConnected
        '
        'Let the client app know that the connection was established.
        RaiseEvent OnConnect
        '
        ' -- --------------------- --
        '

        '
      Case FD_CLOSE
        '
        'This message means that the remote host is closing the conection
        '
        If mvarState = sckClosing Then
            '
            'If a value of the State property already is sckClosing,
            'the closing of the connection was initiated by the local
            'end-point (this socket) of the connection. In other words,
            'the shutdown Winsock API function has been called before
            '(the FIN segment is already sent by the local end-point).
            '
            'In this case we need wait until all the data sent by the
            'remote end-point of the connection will be received.
            '
            Do
                '
                lngBytesReceived = RecvDataToBuffer
                '
                If lngBytesReceived > 0 Then
                    RaiseEvent OnDataArrival(Len(m_strRecvBuffer))
                End If
                '
            Loop Until lngBytesReceived = 0 Or lngBytesReceived = SOCKET_ERROR
            '
          Else 'NOT MVARSTATE...
            '
            mvarState = sckClosing

            '
            'If a value of the State property is not sckClosing, the
            'connectoin is closing by the remote end-point of the
            'connection (the FIN segment is sent by the remote host).
            'In this case we need send all the remained data from the
            'local buffer before to close the socket.
            If Len(m_strSendBuffer) > 0 Then
                '
                Call SendBufferedData
                '
            End If
            '
        End If
        '
        'Close the socket
        Call DestroySocket
        '
        'Change a value of the State property
        mvarState = sckClosed

        '
        'Let the client app that the connection is closed
        RaiseEvent OnClose
        '
    End Select
    '

Exit Sub

    '
ERROR_HANDLER:
    '
    Err.Raise Err.Number, "CSocket.PostSocketEvent", Err.Description    'Modified: 15-APR-2002
    '

End Sub

Friend Sub PostGetHostEvent(ByVal lngRequestID As Long, ByVal lngHostAddress As Long, strHostName As String, Optional lngError As Long)

  '
  'This procedure is called by the WindowProc callback function
  'from the MSocketSupport module. Think about it as about result
  'returned by the ResolveHost function called from this class.
  '

  Dim udtAddress      As sockaddr_in  'socket address - used by the connect Winsock API function
  Dim lngRetValue     As Long         'value returned by the connect Winsock API function
  Dim lngPtrToAddress As Long         'pointer to the string that contains IP address - value

    'returned by the inet_ntoa Winsock API function
    '
    On Error GoTo ERROR_HANDLER
    '
    If lngError > 0 Then
        '
        'An error was occerred during resolving the host hame.
        'For example: "Host not found"
        '
        '----------------------------------------------------------------
        'Added: 28-APR-2002
        'There is the case when a computer has a valid IP address
        'but its name cannot be resolved. In this case the code should
        'countinue the execution - we just don't need to change the
        'RemoteHost property value.
        '----------------------------------------------------------------
        '
        'Does the strHostName argument contain a valid IP address?
        lngHostAddress = inet_addr(strHostName)
        '
        If lngHostAddress = INADDR_NONE Then    'Added: 28-APR-2002
            '
            'Change a value of the State property
            mvarState = sckError

            '
            'Let the client app that an error was occurred.
            RaiseEvent OnError(CInt(lngError), GetErrorDescription(lngError), 0, "", "", 0, False)
            '
            Exit Sub '>---> Bottom
            '
          Else    'Added: 28-APR-2002'NOT LNGHOSTADDRESS...
            '
            'Nothing to do here
            'Both properties the RemoteHost and RemoteHostIP
            'have the same value of the IP address string.
            '
        End If  'Added: 28-APR-2002
        '
    End If
    '
    'Check the id value - Do we really need this?
    If lngRequestID = 0 Then Exit Sub ':(燛xpand Structure or consider reversing Condition
    '
    If lngRequestID = m_lngRequestID Then
        '
        'Change a value of the State property
        mvarState = sckHostResolved

        '
        'Initialize the RemoteHost property
        m_strRemoteHost = strHostName
        '
        'Get pointer to the string that contains the IP address
        lngPtrToAddress = inet_ntoa(lngHostAddress)
        '
        'Retrieve that string by the pointer and init the
        'RemoteHostIP property.
        m_strRemoteHostIP = StringFromPointer(lngPtrToAddress)
        '
        'The ResolveHost function may be called from two methods
        'of the class: Connect and SendData. The m_varInternalState
        'variable tells us where the ResolveHost function called
        'from, and thus what to do here.
        '
        If m_varInternalState = istConnecting Then
            '
            'The ResolveHost was called from the Connect method, so
            'we need to continue the process of the connection establishing.
            '
            'Build the sockaddr_in structure to pass it to the connect
            'Winsock API function as an address of the remote host.
            With udtAddress
                '
                .sin_addr = lngHostAddress
                .sin_family = AF_INET
                .sin_port = htons(UnsignedToInteger(CLng(m_lngRemotePort)))
                '
            End With 'UDTADDRESS
            '
            'Call the connect Winsock API function in order to establish connection.
            lngRetValue = api_connect(m_lngSocketHandle, udtAddress, Len(udtAddress))
            '
            'Since the socket we use is a non-blocking one, the connect Winsock API
            'function should return a value of SOCKET_ERROR anyway.
            '
            If lngRetValue = SOCKET_ERROR Then
                '
                'The WSAEWOULDBLOCK error is OK for such a socket
                '
                If Not Err.LastDllError = WSAEWOULDBLOCK Then
                    Err.Raise Err.LastDllError, "CSocket.PostGetHostEvent", GetErrorDescription(Err.LastDllError)
                  Else 'NOT NOT...
                    'Change the State property value
                    mvarState = sckConnecting

                End If
                '
            End If
            '
          ElseIf m_varInternalState = istSendingDatagram Then 'NOT M_VARINTERNALSTATE...
            '
            'The ResolveHost was called from the SendData method in
            'the case when a message-oriented (UDP) socket is used.
            '
            Call SendBufferedData
            '
        End If
        '
    End If
    '

Exit Sub

    '
ERROR_HANDLER:
    '
    Err.Raise Err.Number, "CSocket.PostGetHostEvent", Err.Description
    '

End Sub

Private Function SocketExists() As Boolean

  '

    If m_lngSocketHandle = INVALID_SOCKET Then
        '
        'If the m_lngSocketHandle is not a valid value, call
        'the vbSocket function in order to create a new socket
        m_lngSocketHandle = vbSocket
        '
        If m_lngSocketHandle = SOCKET_ERROR Then

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产馆精品极品| 国产精品91xxx| 亚洲日穴在线视频| 国产精品欧美一区喷水| 国产农村妇女精品| 国产精品欧美一级免费| 欧美国产日韩a欧美在线观看| 精品国产成人在线影院 | 亚洲一卡二卡三卡四卡五卡| 国产精品国产三级国产普通话99 | 国产成a人亚洲精| 国产成人啪免费观看软件| 成人av在线电影| 色婷婷综合久久久中文一区二区| 91丝袜高跟美女视频| 在线观看91精品国产入口| 欧美探花视频资源| 日韩一区二区三区电影在线观看| 日韩美女在线视频| 国产欧美精品一区二区色综合| 国产精品免费久久| 亚洲高清一区二区三区| 久久精品国产色蜜蜜麻豆| 国产不卡免费视频| 欧美在线制服丝袜| 亚洲精品在线一区二区| **性色生活片久久毛片| 日日摸夜夜添夜夜添国产精品| 国产乱淫av一区二区三区| av影院午夜一区| 欧美一级一区二区| 国产精品区一区二区三区| 亚洲一区二区三区四区的| 蜜桃一区二区三区在线| www..com久久爱| 在线不卡的av| 欧美国产精品v| 日韩国产精品久久久久久亚洲| 国产精品一二三在| 欧美日韩中文另类| 欧美国产国产综合| 奇米影视在线99精品| 成人免费视频网站在线观看| 9191久久久久久久久久久| 国产欧美日韩一区二区三区在线观看| 亚洲精品欧美综合四区| 国产一区二区视频在线| 在线不卡一区二区| 亚洲精品成人天堂一二三| 国内精品第一页| 欧美三级中文字幕在线观看| 国产精品国产三级国产有无不卡 | 欧美美女bb生活片| 1区2区3区精品视频| 久久er99精品| 欧美久久婷婷综合色| 亚洲啪啪综合av一区二区三区| 久久国产人妖系列| 欧美一卡在线观看| 午夜精品久久一牛影视| 91在线无精精品入口| 中文字幕欧美区| 国产成人综合在线播放| 久久久欧美精品sm网站| 蜜臀久久久99精品久久久久久| 欧美猛男gaygay网站| 亚洲激情校园春色| 一本到不卡精品视频在线观看| 久久久不卡影院| 国产成人自拍在线| 久久久久九九视频| 国产成人免费在线观看不卡| 2024国产精品视频| 国产成人综合亚洲91猫咪| 国产三级三级三级精品8ⅰ区| 久久99精品久久久久久久久久久久| 欧美日韩成人综合在线一区二区| 一二三区精品视频| 欧美日韩成人综合天天影院| 亚洲小说春色综合另类电影| 欧美丝袜丝交足nylons图片| 亚洲韩国一区二区三区| 欧美丰满美乳xxx高潮www| 青椒成人免费视频| 久久这里只精品最新地址| 国内精品伊人久久久久av一坑| 精品乱人伦小说| 国产伦精品一区二区三区免费 | 精品一区精品二区高清| 日韩欧美成人激情| 国产福利一区二区三区视频在线| 欧美极品另类videosde| 成人黄色片在线观看| 亚洲乱码中文字幕综合| 这里只有精品视频在线观看| 日韩av网站免费在线| 久久久久综合网| 91麻豆国产在线观看| 丝袜诱惑亚洲看片| 久久久久久麻豆| 日本韩国精品一区二区在线观看| 亚洲va国产天堂va久久en| 欧美大片在线观看| 波多野结衣在线aⅴ中文字幕不卡| 亚洲美女免费在线| 91精品久久久久久久99蜜桃 | 91国内精品野花午夜精品| 亚洲国产日韩a在线播放| 91精品国产日韩91久久久久久| 国产精品一卡二卡在线观看| 一区二区三区四区五区视频在线观看 | 日韩一级二级三级| 国产成人在线视频网站| 亚洲一区二区三区爽爽爽爽爽| xfplay精品久久| 欧美亚洲图片小说| 国产剧情av麻豆香蕉精品| 伊人色综合久久天天人手人婷| 欧美大胆一级视频| 在线观看网站黄不卡| 蜜臀av国产精品久久久久| 一区二区三区欧美激情| 久久久国产午夜精品| 欧美亚洲综合久久| 99天天综合性| 韩国视频一区二区| 美女高潮久久久| 亚洲综合成人在线视频| 欧美国产日韩在线观看| 欧美精品一区二区三区在线播放| 日本电影欧美片| 大陆成人av片| 国产成人午夜视频| 蜜桃av一区二区在线观看| 亚洲自拍另类综合| 国产精品狼人久久影院观看方式| 精品99一区二区三区| 51精品国自产在线| 欧美色爱综合网| 欧美撒尿777hd撒尿| 91亚洲国产成人精品一区二区三| 国产麻豆9l精品三级站| 久久99精品国产91久久来源| 日韩精品电影在线| 亚洲第一成年网| 亚洲成人你懂的| 亚洲午夜成aⅴ人片| 亚洲一区视频在线观看视频| 亚洲特级片在线| 亚洲欧美偷拍三级| 亚洲视频免费在线观看| 亚洲免费在线播放| 亚洲同性gay激情无套| 国产精品久久久久久久蜜臀| 欧美国产日本视频| 成人免费一区二区三区视频| 亚洲视频精选在线| 国产精品美日韩| 亚洲天堂福利av| 亚洲影视在线观看| 日韩中文字幕亚洲一区二区va在线 | 精品福利一区二区三区免费视频| 91精品国产综合久久久久| 欧美调教femdomvk| 欧美日韩精品是欧美日韩精品| 欧美日韩国产免费| 日韩视频国产视频| 精品成人一区二区| 欧美国产乱子伦 | 国产成人精品一区二区三区四区 | 制服丝袜亚洲播放| 日韩一区二区三区四区| 久久嫩草精品久久久精品 | 欧美在线一二三| 欧美一区二区在线免费观看| 26uuu色噜噜精品一区| 国产精品美女久久久久久| 亚洲一区成人在线| 激情亚洲综合在线| 色狠狠综合天天综合综合| 欧美日韩国产在线播放网站| 精品国产一区a| 亚洲天堂免费在线观看视频| 香港成人在线视频| 国产精品资源在线| 欧美在线短视频| 亚洲精品一区二区三区影院| 中文字幕一区二区三区蜜月 | 中文字幕中文字幕在线一区 | 国产午夜精品福利| 亚洲国产精品久久久男人的天堂 | 91免费视频网| 欧美一区二区三区四区在线观看| 久久久精品免费网站| 悠悠色在线精品| 国产成人精品影视| 日韩精品自拍偷拍| 亚洲国产精品视频| 成人av资源站| 久久影院午夜片一区|