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

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

?? csocket.cls

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

    '
    'Maybe you expect to see the connect Winsock API function
    'here, but instead the MScoketSupport.ResolveHost one is
    'called. The connect function does its work in another place
    'of this class - in the PostGetHostEvent procedure, since we
    'need an address of the host in order to establish a connection.
    '
    'The ResolveHost function, that can be found in the MSocketSupport
    'module, will call either the WSAAsyncGetHostByName or WSAAsyncGetHostByAddress
    'depending on what is passed to it with the first argument. Anyway, those
    'functions are asynchronous ones, so code in this class will be executing
    'after the call to the PostGetHostEvent procedure from the WindowProc function
    'in the MSupportSocket.
    '
    'Also, as you can see, the second argument is a pointer to the object, that is
    'this instance of the CSocket class. We need this because the MSocketSupport
    'module is supposed to serve several sockets, not a single one. So the
    'MSocketSupport module should know which CSocket's instance to return info to.
    '
    m_lngRequestID = 0
    m_varInternalState = istConnecting
    m_lngRequestID = MSocketSupport.ResolveHost(m_strRemoteHost, ObjPtr(Me))
    '
EXIT_LABEL:
    '

Exit Sub

    '
Connect_Err_Handler:
    '
    Err.Raise Err.Number, "CSocket.CSocket.Connect", Err.Description
    '
    GoTo EXIT_LABEL
    '

End Sub

Public Sub CloseSocket()
Attribute CloseSocket.VB_Description = "Close current connection"

  '

  Dim lngRetValue As Long 'value returned by the shutdown Winsock API function

    '
    On Error GoTo Close_Err_Handler
    '
    'Why do we need to run the code that should not be running?
    If m_lngSocketHandle = INVALID_SOCKET Then Exit Sub ':(燛xpand Structure or consider reversing Condition
    '
    If Not mvarState = sckConnected Then
        '
        'If the socket is not connected we can just close it
        Call DestroySocket
        mvarState = sckClosed

        '
      Else 'NOT NOT...
        '
        'If the socket is connected, it's another story.
        'In order to be sure that no data will be lost the
        'graceful shutdown of the socket should be performed.
        '
        mvarState = sckClosing

        '
        'Call the shutdown Winsock API function in order to
        'close the connection. That doesn't mean that the
        'connection will be closed after the call of the
        'shutdown function. Connection will be closed from
        'the PostSocketEvent subroutine when the FD_CLOSE
        'message will be received.
        '
        'For people who know what the FIN segment in the
        'TCP header is - this function sends an empty packet
        'with the FIN bit turned on.
        '
        lngRetValue = shutdown(m_lngSocketHandle, SD_SEND)
        '

        '
        If lngRetValue = SOCKET_ERROR Then
            Err.Raise Err.LastDllError, "CSocket.CloseSocket", GetErrorDescription(Err.LastDllError)
        End If
        '
    End If

EXIT_LABEL:
    '

Exit Sub

    '
Close_Err_Handler:
    '
    If Err.Number <> 10038 Then
        'Err.Raise Err.Number, "CSocket.Close", Err.Description
    End If
    '
    GoTo EXIT_LABEL
    '

End Sub

Public Sub Bind(Optional lngLocalPort As Long, Optional strLocalIP As String)
Attribute Bind.VB_Description = "Binds socket to specific port and adapter"

  '

  Dim lngRetValue     As Long         'value returned by the bind Winsock API function
  Dim udtLocalAddr    As sockaddr_in  'local socket address to bind to - used by the

    '                                    bind Winsock API function
  Dim lngAddress      As Long         '32-bit host address - value returned by':(燤ove line to top of current Sub
    '                                    the inet_addr Winsock API function
    '
    On Error GoTo Bind_Err_Handler
    '
    'If no socket has been created before, try to create a new one
    If Not SocketExists Then Exit Sub ':(燛xpand Structure or consider reversing Condition
    '
    'If the arguments of this function are not missing, they
    'overwrites values of the RemoteHost and RemotePort properties.
    '
    If Len(strLocalIP) > 0 Then
        m_strLocalIP = strLocalIP
    End If
    '
    If lngLocalPort > 0 Then
        m_lngLocalPort = lngLocalPort
    End If
    '
    If Len(m_strLocalIP) > 0 Then
        '
        'If the local IP is known, get the address
        'from it with the inet_addr Winsock API function.
        lngAddress = inet_addr(m_strLocalIP)
        '
      Else 'NOT LEN(M_STRLOCALIP)...
        '
        'If the IP is unknown, assign the default interface's IP.
        'Actually, this line is useless in Visual Basic code,
        'as INADDR_ANY = 0 (IP = 0.0.0.0).
        lngAddress = INADDR_ANY
        '
    End If
    '
    If lngAddress = SOCKET_ERROR Then
        '
        'Bad address - go away
        Err.Raise Err.LastDllError, "CSocket.Bind", GetErrorDescription(Err.LastDllError)
        Exit Sub '>---> Bottom
        '
    End If
    '
    'Prepare the udtLocalAddr UDT that is a socket address structure.
    With udtLocalAddr
        '
        .sin_addr = lngAddress  'host address (32-bits value)
        .sin_family = AF_INET   'address family
        .sin_port = htons(LongToUnsigned(m_lngLocalPort))   'port number in the network byte order
        '
    End With 'UDTLOCALADDR
    '
    'Call the bind Winsock API function in order to assign local address for the socket
    lngRetValue = api_bind(m_lngSocketHandle, udtLocalAddr, Len(udtLocalAddr))
    '
    If lngRetValue = SOCKET_ERROR Then
        '
        Err.Raise Err.LastDllError, "CSocket.Bind", GetErrorDescription(Err.LastDllError)
        '
      Else 'NOT LNGRETVALUE...
        '
        m_blnSocketIsBound = True   'Added: 10-MAR-2002
        '
    End If
    '
EXIT_LABEL:
    '

Exit Sub

    '
Bind_Err_Handler:
    '
    Err.Raise Err.Number, "CSocket.Bind", Err.Description
    '
    GoTo EXIT_LABEL
    '

End Sub

Public Sub Accept(requestID As Long)
Attribute Accept.VB_Description = "Accept an incoming connection request"

  '
  'The requestID argument is provided with the ConnectRequest
  'event of another instance of the CSocket class. Actually,
  'this argument is a handle of the socket already created
  'calling the Accept Winsock API function by that (another)
  'instance of the CSocket class.
  '

  Dim lngRetValue As Long         'value returned by the getsockname, getpeername, and

    '                                getsockopt Winsock API functions
  Dim lngBuffer   As Long         'the buffer to pass with the getsockopt Winsock API function':(燤ove line to top of current Sub
  Dim udtSockAddr As sockaddr_in  'socket address - used by the getsockname and getpeername':(燤ove line to top of current Sub
    '                                Winsock API functions
  Dim udtHostEnt  As HostEnt      'structure to hold the host info - returned by the':(燤ove line to top of current Sub
    '                                getsockname and getpeername Winsock API functions
    '
    On Error GoTo Accept_Err_Handler
    '
    'What we need to do in the body of this subroutine is to
    'initialize the properties of the class that we can find
    'values for. Also we need to register the socket with
    'the RegisterSocket function from MSocketSupport module.
    '
    'Assign the socket handle
    m_lngSocketHandle = requestID
    '
    'Retrieve the connection end-points to initialize
    'the following properties of the CSocket class:
    'LocalPort, LocalIP, LocalHostName
    'RemotePort, RemoteHostIP, RemoteHost
    '
    'Local end point
    '
    lngRetValue = getsockname(m_lngSocketHandle, udtSockAddr, Len(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
    '
    'Remote end point
    '
    lngRetValue = getpeername(m_lngSocketHandle, udtSockAddr, Len(udtSockAddr))
    '
    If lngRetValue = 0 Then
        '
        'RemotePort property
        m_lngRemotePort = IntegerToUnsigned(ntohs(udtSockAddr.sin_port))
        'RemoteHostIP property
        m_strRemoteHostIP = StringFromPointer(inet_ntoa(udtSockAddr.sin_addr))
        'RemoteHost property
        lngRetValue = gethostbyaddr(udtSockAddr.sin_addr, 4&, AF_INET)
        CopyMemory udtHostEnt, ByVal lngRetValue, Len(udtHostEnt)
        m_strRemoteHost = StringFromPointer(udtHostEnt.hName)
        '
    End If
    '
    'Retrieve the socket type to initialize the Protocol property
    lngRetValue = getsockopt(m_lngSocketHandle, SOL_SOCKET, SO_TYPE, lngBuffer, LenB(lngBuffer))
    '
    If lngRetValue <> SOCKET_ERROR Then
        '
        If lngBuffer = SOCK_STREAM Then
            mvarProtocol = sckTCPProtocol
          Else 'NOT LNGBUFFER...
            mvarProtocol = sckUDPProtocol
        End If
        '
    End If
    '
    'Get default size of the Winsock's buffers.
    Call GetWinsockBuffers  'Added: 10-MAR-2002
    '
    If MSocketSupport.RegisterSocket(m_lngSocketHandle, ObjPtr(Me)) Then
        '
        'Change the State property value
        mvarState = sckConnected

        '
    End If
    '
EXIT_LABEL:
    '

Exit Sub

    '
Accept_Err_Handler:
    '
    Err.Raise Err.Number, "CSocket.Accept", Err.Description
    '
    GoTo EXIT_LABEL
    '

End Sub

Public Property Get State() As StateConstants

    State = mvarState

End Property

Public Property Get SocketHandle() As Long
Attribute SocketHandle.VB_Description = " Returns the socket handle"

    SocketHandle = m_lngSocketHandle

End Property

Public Property Get RemotePort() As Long
Attribute RemotePort.VB_Description = "Returns/Sets the port to be connected to on the remote computer"

    RemotePort = m_lngRemotePort

End Property

Public Property Let RemotePort(NewValue As Long)

    m_lngRemotePort = NewValue

End Property

Public Property Get RemoteHostIP() As String
Attribute RemoteHostIP.VB_Description = "Returns the remote host IP address"

    RemoteHostIP = m_strRemoteHostIP

End Property

Public Property Get RemoteHost() As String
Attribute RemoteHost.VB_Description = "Returns/Sets the name used to identify the remote computer"

    RemoteHost = m_strRemoteHost

End Property

Public Property Let RemoteHost(NewValue As String)

    m_strRemoteHostIP = ""
    m_strRemoteHost = NewValue

End Property

Public Property Get protocol() As ProtocolConstants
Attribute protocol.VB_Description = "Returns/Sets the socket protocol"

    protocol = mvarProtocol

End Property

Public Property Let protocol(NewValue As ProtocolConstants)

  '

    If m_lngSocketHandle = INVALID_SOCKET Then  'Modified: 10-MAR-2002
        mvarProtocol = NewValue
    End If
    '

End Property

Public Property Get LocalPort() As Long
Attribute LocalPort.VB_Description = "Returns/Sets the port used on the local computer"

    LocalPort = m_lngLocalPort

End Property

Public Property Let LocalPort(NewValue As Long)

    m_lngLocalPort = NewValue

End Property

Public Property Get LocalIP() As String
Attribute LocalIP.VB_Description = "Returns the local machine IP address"

    LocalIP = m_strLocalIP

End Property

Public Property Get LocalHostName() As String
Attribute LocalHostName.VB_Description = "Returns the local machine name"

    LocalHostName = m_strLocalHostName

End Property

Public Property Get BytesReceived() As Long
Attribute BytesReceived.VB_Description = "Returns the number of bytes received on this connection"

    BytesReceived = m_lngBytesReceived

End Property

Private Sub Class_Initialize()

  '
  'Socket's handle default value

    m_lngSocketHandle = INVALID_SOCKET
    'Initialize the Winsock service
    m_lngMaxMsgSize = MSocketSupport.InitWinsockService

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女网站色| 欧美在线不卡一区| 偷拍一区二区三区| 亚洲成在线观看| 婷婷六月综合网| 日韩高清中文字幕一区| 日韩经典一区二区| 久久成人麻豆午夜电影| 日产欧产美韩系列久久99| 亚洲高清中文字幕| 日韩精品视频网站| 国产曰批免费观看久久久| 国产一区二区三区久久悠悠色av| 国产麻豆视频一区| 不卡一区中文字幕| 欧美在线不卡一区| 精品少妇一区二区| 国产精品乱人伦一区二区| 自拍视频在线观看一区二区| 一区二区三区精品视频在线| 天堂va蜜桃一区二区三区| 国产一区二区伦理| 99在线视频精品| 欧美日本精品一区二区三区| 精品理论电影在线| 中文字幕一区在线观看| 亚洲综合视频在线观看| 久久99久久99| 色综合久久66| 日韩精品一区二区三区四区| 国产精品人妖ts系列视频| 亚洲一级二级三级在线免费观看| 男女男精品视频网| 99精品视频在线播放观看| 欧美丰满一区二区免费视频| 国产网站一区二区三区| 亚洲一区二区五区| 国产电影一区在线| 欧美日本乱大交xxxxx| 国产精品丝袜久久久久久app| 一区二区三区 在线观看视频| 麻豆精品一二三| 91视频一区二区三区| 日韩午夜小视频| 亚洲欧美日韩一区二区| 国产一区二区三区在线观看精品| 色综合天天综合网国产成人综合天| 国产精品久久久久久久久免费丝袜 | 欧美日韩一区二区三区四区| 亚洲欧洲精品一区二区三区不卡| 不卡av在线免费观看| 国产精品国产三级国产a| 9久草视频在线视频精品| 一区二区三区免费| 欧美一区二区三区在线| 国内成+人亚洲+欧美+综合在线| 久久久久国产成人精品亚洲午夜| 国产91精品精华液一区二区三区| 中文字幕一区视频| 欧美视频一二三区| 国产毛片精品国产一区二区三区| 国产精品毛片久久久久久久| 色噜噜狠狠色综合中国| 午夜成人免费视频| 久久久久久久久久电影| 欧日韩精品视频| 狠狠网亚洲精品| 亚洲精品国产第一综合99久久| 日韩一区二区在线观看视频播放| 国产成人h网站| 午夜精品成人在线| 亚洲国产成人在线| 欧美理论在线播放| 成人精品一区二区三区四区 | 成人av影院在线| 亚洲第一福利视频在线| 久久久久高清精品| 制服丝袜成人动漫| 99久久精品免费精品国产| 免费的成人av| 亚洲国产另类av| 国产精品三级久久久久三级| 欧美日韩激情一区二区三区| 粉嫩av一区二区三区| 亚洲成av人片www| 亚洲欧美视频在线观看| 国产视频一区在线播放| 欧美一级视频精品观看| 91浏览器在线视频| 国产成人在线电影| 国产资源精品在线观看| 日韩精品乱码av一区二区| 亚洲欧洲综合另类| 亚洲国产精品ⅴa在线观看| 91麻豆精品国产91久久久更新时间 | 日本欧美在线观看| 亚洲欧美激情插| 国产精品水嫩水嫩| 国产拍揄自揄精品视频麻豆| 日韩精品一区二区三区老鸭窝| 欧美亚洲综合久久| 色视频成人在线观看免| 成人激情视频网站| 国产九色sp调教91| 精品亚洲国内自在自线福利| 日本色综合中文字幕| 婷婷夜色潮精品综合在线| 亚洲小说春色综合另类电影| 亚洲欧美日韩国产成人精品影院| 欧美国产在线观看| 国产日韩欧美精品一区| 久久久91精品国产一区二区精品 | 91精彩视频在线| 99久久精品一区二区| 99视频超级精品| 91在线视频观看| 色综合色狠狠综合色| 91免费观看在线| 91丨porny丨蝌蚪视频| 色老汉一区二区三区| 日本电影亚洲天堂一区| 99精品视频中文字幕| 色猫猫国产区一区二在线视频| 91论坛在线播放| 精品视频一区二区不卡| 91精品婷婷国产综合久久竹菊| 欧美一级片免费看| 欧美成人aa大片| 久久精品视频一区二区三区| 国产精品视频一区二区三区不卡| 国产精品毛片高清在线完整版| 国产精品久久久久久久久晋中| 亚洲人成网站影音先锋播放| 亚洲成人av一区二区三区| 日本91福利区| 国产精品系列在线播放| 97久久久精品综合88久久| 欧美在线free| 精品福利av导航| 国产精品美女久久久久久| 亚洲成年人影院| 国内久久精品视频| 99久久国产综合精品色伊| 欧美日韩亚洲丝袜制服| 久久久久综合网| 一区二区三区免费| 久久99国内精品| av欧美精品.com| 欧美一区三区四区| 国产精品情趣视频| 亚洲国产精品一区二区尤物区| 玖玖九九国产精品| 波多野结衣中文字幕一区二区三区| 欧洲一区二区av| 国产午夜精品一区二区| 亚洲妇熟xx妇色黄| 国产精品66部| 欧美日韩高清不卡| 国产精品女主播在线观看| 亚洲成a人片综合在线| 久久疯狂做爰流白浆xx| 91国产丝袜在线播放| 精品sm捆绑视频| 亚洲一区二区三区四区在线免费观看 | 日韩高清不卡一区| 成人亚洲一区二区一| 在线成人av网站| 国产精品久久久久久久岛一牛影视 | 91精品国产乱码| 中文字幕在线一区免费| 久久精品噜噜噜成人88aⅴ| 在线亚洲一区二区| 亚洲国产精品精华液2区45| 人人精品人人爱| 欧美日韩国产综合一区二区| 国产精品久久午夜| 精品一区二区三区av| 欧美日韩www| 尤物视频一区二区| www.亚洲精品| 久久久精品国产免费观看同学| 美女视频一区二区| 91精品国产综合久久香蕉的特点 | 色哟哟欧美精品| 亚洲国产精华液网站w | 亚洲一区免费在线观看| 99久久婷婷国产精品综合| 久久久综合精品| 国产资源在线一区| 精品理论电影在线| 久草精品在线观看| 日韩欧美国产系列| 美女精品一区二区| 日韩一卡二卡三卡国产欧美| 亚洲第一激情av| 欧美精品久久天天躁| 亚洲超碰精品一区二区| 欧美日韩一区二区在线观看| 五月天久久比比资源色| 51精品国自产在线|