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

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

?? csocketmaster.cls

?? 本程序可以設置本機自動與Internet時間同步。
?? CLS
?? 第 1 頁 / 共 4 頁
字號:
If lngErrorCode = 0 Then 'if there weren't errors trying to resolve the hostname
    
    m_enmState = sckHostResolved: Debug.Print "STATE: sckHostResolved"
    
    Dim udtHostent As HOSTENT
    Dim lngPtrToIP As Long
    Dim arrIpAddress(1 To 4) As Byte
    Dim lngRemoteHostAddress As Long
    Dim Count As Integer
    Dim strIpAddress As String
    
    api_CopyMemory udtHostent, ByVal m_lngMemoryPointer, LenB(udtHostent)
    api_CopyMemory lngPtrToIP, ByVal udtHostent.hAddrList, 4
    api_CopyMemory arrIpAddress(1), ByVal lngPtrToIP, 4
    api_CopyMemory lngRemoteHostAddress, ByVal lngPtrToIP, 4
    
    'free memmory, won't need it any longer
    FreeMemory
    
    'We turn the 32 bits long into a readable string.
    'Note: we don't need this string. I put this here just
    'in case you need it.
    For Count = 1 To 4
        strIpAddress = strIpAddress & arrIpAddress(Count) & "."
    Next
        
    strIpAddress = Left$(strIpAddress, GetLong(strIpAddress) - 1)
    
    'Decide what to do with the result according to the destination
    Select Case enmDestination
    
    Case destConnect
        ConnectToIP lngRemoteHostAddress, 0
    
    End Select

Else 'there were errors trying to resolve the hostname

    'free buffer memory
    FreeMemory
    
    Select Case enmDestination
        
    Case destConnect
        ConnectToIP vbNull, lngErrorCode
        
    End Select

End If
End Sub

'This procedure is called by the WindowProc callback function
'from the modSocketMaster module. The lngEventID argument is an
'ID of the network event occurred for the socket. The lngErrorCode
'argument contains an error code only if an error was occurred
'during an asynchronous execution.
Private Sub PostSocket(ByVal lngEventID As Long, ByVal lngErrorCode As Long)

'handle any possible error
If lngErrorCode <> 0 Then
    m_enmState = sckError: Debug.Print "STATE: sckError"
    Dim blnCancelDisplay As Boolean
    blnCancelDisplay = True
    RaiseEvent Error(lngErrorCode, GetErrorDescription(lngErrorCode), 0, "CSocketMaster.PostSocket", "", 0, blnCancelDisplay)
    If blnCancelDisplay = False Then MsgBox GetErrorDescription(lngErrorCode), vbOKOnly, "CSocketMaster.PostSocket"
    Exit Sub
End If

Dim udtSockAddr As sockaddr_in
Dim lngResult As Long
Dim lngBytesReceived As Long

Select Case lngEventID

'======================================================================

Case FD_CONNECT

    'Arrival of this message means that the connection initiated by the call
    'of the connect Winsock API function was successfully established.

    Debug.Print "FD_CONNECT " & m_lngSocketHandle
    
    If m_enmState <> sckConnecting Then
        Debug.Print "WARNING: Omitting FD_CONNECT"
        Exit Sub
    End If
    
    'Get the connection local end-point parameters
    lngResult = api_getpeername(m_lngSocketHandle, udtSockAddr, LenB(udtSockAddr))
        
    If lngResult = 0 Then
        m_lngRemotePort = modSocketMaster.IntegerToUnsigned(api_ntohs(udtSockAddr.sin_port))
        m_strRemoteHostIP = StringFromPointer(api_inet_ntoa(udtSockAddr.sin_addr))
    End If
    
    m_enmState = sckConnected: Debug.Print "STATE: sckConnected"
    RaiseEvent Connect

'======================================================================

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.
    
    Debug.Print "FD_WRITE " & m_lngSocketHandle
    
    If m_enmState <> sckConnected Then
        Debug.Print "WARNING: Omitting FD_WRITE"
        Exit Sub
    End If
    
    If GetLong(m_strSendBuffer) > 0 Then
        SendBufferedData
    End If
    
'======================================================================

Case FD_READ

    'Some data has arrived for this socket.

    Debug.Print "FD_READ " & m_lngSocketHandle
    
    If m_enmProtocol = sckTCPProtocol Then
        
        If m_enmState <> sckConnected Then
            Debug.Print "WARNING: Omitting FD_READ"
            Exit Sub
        End If
        
        'Call the RecvDataToBuffer function that move arrived data
        'from the Winsock buffer to the local one and returns number
        'of bytes received.
    
        lngBytesReceived = RecvDataToBuffer
    
        If lngBytesReceived > 0 Then
            RaiseEvent DataArrival(GetLong(m_strRecvBuffer))
        End If
    
    Else 'UDP protocol
        
        If m_enmState <> sckOpen Then
            Debug.Print "WARNING: Omitting FD_READ"
            Exit Sub
        End If
        
        'If we use UDP we don't remove data from winsock buffer.
        'We just let the user know the amount received so
        'he/she can decide what to do.
        
        lngBytesReceived = GetBufferLenUDP
        
        If lngBytesReceived > 0 Then
            RaiseEvent DataArrival(lngBytesReceived)
        End If
        
        
        'Now the buffer is emptied no matter what the user
        'dicided to do with the received data
        EmptyBuffer
    End If
    
    
'======================================================================

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.
  
    Debug.Print "FD_ACCEPT " & m_lngSocketHandle
    If m_enmState <> sckListening Then
        Debug.Print "WARNING: Omitting FD_ACCEPT"
        Exit Sub
    End If
    
    lngResult = api_accept(m_lngSocketHandle, udtSockAddr, LenB(udtSockAddr))
    
    If lngResult = INVALID_SOCKET Then
        lngErrorCode = Err.LastDllError
        Err.Raise lngErrorCode, "CSocketMaster.PostSocket", GetErrorDescription(lngErrorCode)
    Else
        'We assign a temporal instance of CSocketMaster to
        'handle this new socket until user accepts (or not)
        'the new connection
        modSocketMaster.RegisterAccept lngResult
        
        'We change remote info before firing ConnectionRequest
        'event so the user can see which host is trying to
        'connect.
        
        Dim lngTempRP As Long
        Dim strTempRHIP As String
        Dim strTempRH As String
        lngTempRP = m_lngRemotePort
        strTempRHIP = m_strRemoteHostIP
        strTempRH = m_strRemoteHost
        
        GetRemoteInfo lngResult, m_lngRemotePort, m_strRemoteHostIP, m_strRemoteHost
        
        Debug.Print "OK Accepted socket: " & lngResult
        RaiseEvent ConnectionRequest(lngResult)
        
        'we return original info
        If m_enmState = sckListening Then
             m_lngRemotePort = lngTempRP
             m_strRemoteHostIP = strTempRHIP
             m_strRemoteHost = strTempRH
        End If
        
        'This is very important. If the connection wasn't accepted
        'we must close the socket.
        If IsAcceptRegistered(lngResult) Then
            api_closesocket lngResult
            modSocketMaster.UnregisterSocket lngResult
            modSocketMaster.UnregisterAccept lngResult
            Debug.Print "OK Closed accepted socket: " & lngResult
        End If
    End If
    
'======================================================================
    
Case FD_CLOSE
    
    'This message means that the remote host is closing the conection
    
    Debug.Print "FD_CLOSE " & m_lngSocketHandle
    
    If m_enmState <> sckConnected Then
        Debug.Print "WARNING: Omitting FD_CLOSE"
        Exit Sub
    End If
    
    m_enmState = sckClosing: Debug.Print "STATE: sckClosing"
    RaiseEvent CloseSck
    
End Select
End Sub

'Connect to a given 32 bits long ip
Private Sub ConnectToIP(ByVal lngRemoteHostAddress As Long, ByVal lngErrorCode As Long)

Dim blnCancelDisplay As Boolean

'Check and handle errors
If lngErrorCode <> 0 Then
    m_enmState = sckError: Debug.Print "STATE: sckError"
    blnCancelDisplay = True
    RaiseEvent Error(lngErrorCode, GetErrorDescription(lngErrorCode), 0, "CSocketMaster.ConnectToIP", "", 0, blnCancelDisplay)
    If blnCancelDisplay = False Then MsgBox GetErrorDescription(lngErrorCode), vbOKOnly, "CSocketMaster.ConnectToIP"
    Exit Sub
End If

'Here we bind the socket
If Not BindInternal Then Exit Sub

Debug.Print "OK Connecting to: " + m_strRemoteHost + " " + m_strRemoteHostIP
m_enmState = sckConnecting: Debug.Print "STATE: sckConnecting"

Dim udtSockAddr As sockaddr_in
Dim lngResult As Long

'Build the sockaddr_in structure to pass it to the connect
'Winsock API function as an address of the remote host.
With udtSockAddr
    .sin_addr = lngRemoteHostAddress
    .sin_family = AF_INET
    .sin_port = api_htons(modSocketMaster.UnsignedToInteger(m_lngRemotePort))
End With

'Call the connect Winsock API function in order to establish connection.
lngResult = api_connect(m_lngSocketHandle, udtSockAddr, LenB(udtSockAddr))

'Check and handle errors
If lngResult = SOCKET_ERROR Then
    lngErrorCode = Err.LastDllError
    If lngErrorCode <> WSAEWOULDBLOCK Then
        If lngErrorCode = WSAEADDRNOTAVAIL Then
            Err.Raise WSAEADDRNOTAVAIL, "CSocketMaster.ConnectToIP", GetErrorDescription(WSAEADDRNOTAVAIL)
        Else
            m_enmState = sckError: Debug.Print "STATE: sckError"
            blnCancelDisplay = True
            RaiseEvent Error(lngErrorCode, GetErrorDescription(lngErrorCode), 0, "CSocketMaster.ConnectToIP", "", 0, blnCancelDisplay)
            If blnCancelDisplay = False Then MsgBox GetErrorDescription(lngErrorCode), vbOKOnly, "CSocketMaster.ConnectToIP"
        End If
    End If
End If

End Sub

Public Sub Bind(Optional LocalPort As Variant, Optional LocalIP As Variant)
If m_enmState <> sckClosed Then
    Err.Raise sckInvalidOp, "CSocketMaster.Bind", "Invalid operation at current state"
End If

If BindInternal(LocalPort, LocalIP) Then
    m_enmState = sckOpen: Debug.Print "STATE: sckOpen"
End If
End Sub

'This function binds a socket to a local port and IP.
'Retunrs TRUE if it has success.
Private Function BindInternal(Optional ByVal varLocalPort As Variant, Optional ByVal varLocalIP As Variant) As Boolean
If m_enmState = sckOpen Then
    BindInternal = True
    Exit Function
End If

Dim lngLocalPortInternal As Long
Dim strLocalHostInternal As String
Dim strIP As String
Dim lngAddressInternal As Long
Dim lngResult As Long
Dim lngErrorCode As Long

BindInternal = False

'Check if varLocalPort is a number between 0 and 65535
If Not IsMissing(varLocalPort) Then
    
    If IsNumeric(varLocalPort) Then
        If varLocalPort < 0 Or varLocalPort > 65535 Then
            BindInternal = False
            Err.Raise sckInvalidArg, "CSocketMaster.BindInternal", "The argument passed to a function was not in the correct format or in the specified range."
        Else
            lngLocalPortInternal = CLng(varLocalPort)
        End If
    Else
        BindInternal = False
        Err.Raise sckUnsupported, "CSocketMaster.BindInternal", "Unsupported variant type."
    End If
    
Else
    
    lngLocalPortInternal = m_lngLocalPort
    
End If

If Not IsMissing(varLocalIP) Then
    If varLocalIP <> vbNullString Then
        strLocalHostInternal = CStr(varLocalIP)
    Else
        strLocalHostInternal = GetLocalIP
    End If
Else
    strLocalHostInternal = GetLocalIP
End If

'get a 32 bits long IP
lngAddressInternal = ResolveIfHostnameSync(strLocalHostInternal, strIP, lngResult)

If lngResult <> 0 Then
    Err.Raise sckInvalidArg, "CSocketMaster.BindInternal", "Invalid argument"
End If

'create a socket if there isn't one yet
If Not SocketExists Then Exit Function

Dim udtSockAddr As sockaddr_in

With udtSockAddr
    .sin_addr = lngAddressInternal
    .sin_family = AF_INET
    .sin_port = api_htons(modSocketMaster.UnsignedToInteger(lngLocalPortInternal))
End With

'bind the socket
lngResult = api_bind(m_lngSocketHandle, udtSockAddr, LenB(udtSockAddr))

If lngResult = SOCKET_ERROR Then

    lngErrorCode = Err.LastDllError
    Err.Raise lngErrorCode, "CSocketMaster.BindInternal", GetErrorDescription(lngErrorCode)
    
Else

    m_strLocalIP = strIP
    
    If lngLocalPortInternal <> 0 Then
    
        Debug.Print "OK Bind HOST: " & strLocalHostInternal & " PORT: " & lngLocalPortInternal
        m_lngLocalPort = lngLocalPortInternal
        
    Else
        lngResult = GetLocalPort(m_lngSocketHandle)
        
        If lngResult = SOCKET_ERROR Then
            lngErrorCode = Err.LastDllError
            Err.Raise lngErrorCode, "CSocketMaster.BindInternal", GetErrorDescription(lngErrorCode)
        Else
            Debug.Print "OK Bind HOST: " & strLocalHostInternal & " PORT: " & lngResult
            m_lngLocalPortBind = lngResult
        End If
        
    End If
    
    BindInternal = True
End If
End Function

'Allocate some memory for HOSTEN structure and returns
'a pointer to this buffer if no error occurs.
'Returns 0 if it fails.
Private Function AllocateMemory() As Long
m_lngMemoryHandle = api_GlobalAlloc(GMEM_FIXED, MAXGETHOSTSTRUCT)

If m_lngMemoryHandle <> 0 Then
    m_lngMemoryPointer = api_GlobalLock(m_lngMemoryHandle)
    
    If m_lngMemoryPointer <> 0 Then
        api_GlobalUnlock (m_lngMemoryHandle)
        AllocateMemory = m_lngMemoryPointer
    Else
        api_GlobalFree (m_lngMemoryHandle)
        AllocateMemory = m_lngMemoryPointer '0
    End If

Else
    AllocateMemory = m_lngMemoryHandle '0
End If
End Function

'Free memory allocated by AllocateMemory
Private Sub FreeMemory()
If m_lngMemoryHandle <> 0 Then
    m_lngMemoryHandle = 0
    m_lngMemoryPointer = 0
    api_GlobalFree m_lngMemoryHandle
End If

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚洲欧美国产精品乐播| 久久女同精品一区二区| 欧美性色aⅴ视频一区日韩精品| 91蝌蚪国产九色| 91精品国产综合久久精品性色| 日韩欧美一区二区三区在线| 国产亚洲精品超碰| 亚洲精品免费一二三区| 精品中文字幕一区二区小辣椒| 成人黄动漫网站免费app| 欧美日韩免费一区二区三区| 日韩欧美一级精品久久| 中文字幕高清不卡| 丝瓜av网站精品一区二区| 美女视频一区在线观看| 91在线精品一区二区三区| 在线成人免费视频| 国产精品初高中害羞小美女文| 亚洲丰满少妇videoshd| 国产真实乱偷精品视频免| 成人午夜视频网站| 制服视频三区第一页精品| 亚洲视频一二三| 国产精品中文字幕日韩精品| 欧美性三三影院| 国产欧美精品一区| 久久精工是国产品牌吗| 欧美色大人视频| 亚洲欧洲一区二区在线播放| 日韩av中文字幕一区二区三区| 国产精品一区二区久久精品爱涩 | 日本aⅴ亚洲精品中文乱码| 成人性生交大片免费看中文网站| 制服丝袜中文字幕亚洲| 亚洲综合色网站| 丁香婷婷综合激情五月色| 欧美日韩一级大片网址| 欧美国产精品专区| 亚洲国产精品一区二区久久恐怖片 | 日韩av一级电影| 欧美在线免费观看视频| 亚洲欧美在线aaa| 成人综合在线网站| 日韩欧美一区二区久久婷婷| 蜜桃av一区二区在线观看| 在线观看欧美黄色| 一区二区理论电影在线观看| 精品一区二区av| 日韩久久久精品| 久久99热这里只有精品| 日韩欧美一区二区不卡| 偷窥国产亚洲免费视频| 欧美日韩在线播放| 亚洲国产精品久久艾草纯爱| 成人精品免费网站| 国产精品不卡视频| 99精品1区2区| 亚洲卡通欧美制服中文| 91亚洲精品久久久蜜桃网站| 亚洲免费观看高清完整版在线| 粉嫩嫩av羞羞动漫久久久| 中文字幕不卡在线| 99精品在线观看视频| 亚洲日本免费电影| 精品污污网站免费看| 天天综合色天天| 7777精品伊人久久久大香线蕉超级流畅| 亚洲资源在线观看| 欧美精品xxxxbbbb| 精品一区二区免费看| 中文字幕不卡在线| 欧美唯美清纯偷拍| 麻豆国产精品一区二区三区 | 日韩精品一二三四| 欧美变态口味重另类| 五月天一区二区三区| 欧美videossexotv100| 国产麻豆精品theporn| 中文字幕国产精品一区二区| 欧美性色黄大片手机版| 激情综合五月天| 国产欧美1区2区3区| 懂色一区二区三区免费观看| 亚洲日韩欧美一区二区在线| 色综合久久99| 国模套图日韩精品一区二区| 成人欧美一区二区三区视频网页| 欧美日免费三级在线| 国产九色精品成人porny | 91麻豆精品国产91久久久 | 久久国产精品第一页| 中文字幕乱码日本亚洲一区二区 | 3751色影院一区二区三区| 久久精品国产精品亚洲精品| 亚洲欧洲成人自拍| 欧美电影影音先锋| av中文字幕不卡| 日本人妖一区二区| 国产精品国产精品国产专区不片| 欧美性感一区二区三区| 国产成人在线免费| 蜜桃精品在线观看| 亚洲精品国产高清久久伦理二区| 色94色欧美sute亚洲13| 精品一区二区三区不卡| 午夜精品一区二区三区免费视频| 国产欧美日韩三区| 日韩久久久久久| 欧美性猛交xxxx乱大交退制版| proumb性欧美在线观看| 免费欧美高清视频| 国产精品久久久久影院老司 | 韩国v欧美v日本v亚洲v| 亚洲精品国产品国语在线app| 国产午夜亚洲精品理论片色戒 | 波多野结衣亚洲一区| 麻豆精品视频在线观看视频| 夜夜嗨av一区二区三区网页| 日韩精品一区二区三区三区免费 | 亚洲电影在线播放| 中文字幕在线不卡| 久久久久国产精品麻豆| 欧美一区二区成人| 欧美肥妇毛茸茸| 在线91免费看| 91一区二区在线观看| 不卡高清视频专区| 成人一级黄色片| 粉嫩av亚洲一区二区图片| 精品一区二区精品| 日日噜噜夜夜狠狠视频欧美人| 国产色爱av资源综合区| 久久久99久久精品欧美| 精品福利在线导航| 精品国产乱码久久久久久影片| 日韩视频免费直播| www欧美成人18+| 久久久99免费| 成人免费一区二区三区视频| 中文字幕一区二区三区在线观看| 国产精品毛片高清在线完整版| 久久久精品免费网站| 久久久欧美精品sm网站| 中文字幕免费不卡| 综合婷婷亚洲小说| 亚洲中国最大av网站| 日韩电影免费一区| 日日摸夜夜添夜夜添亚洲女人| 一区二区三区精密机械公司| 亚洲久草在线视频| 亚洲精品在线免费观看视频| 国产精品视频yy9299一区| 亚洲一二三区视频在线观看| 国模无码大尺度一区二区三区| 不卡视频一二三| 欧美日韩国产美女| 国产日韩欧美综合在线| 亚洲高清中文字幕| 国产黑丝在线一区二区三区| 在线精品国精品国产尤物884a| 日韩免费观看高清完整版在线观看| 国产精品成人网| 免费在线观看日韩欧美| 波波电影院一区二区三区| 欧美一级一区二区| 亚洲三级视频在线观看| 国产在线精品免费av| 欧美日韩国产色站一区二区三区| 久久精品亚洲精品国产欧美kt∨| 亚洲电影激情视频网站| av亚洲产国偷v产偷v自拍| 精品国产污网站| 亚洲精品高清视频在线观看| 国产最新精品精品你懂的| 欧美日韩一区在线| 亚洲视频香蕉人妖| 成人黄色国产精品网站大全在线免费观看 | 日韩**一区毛片| 色综合色综合色综合色综合色综合 | 日韩高清在线观看| 91麻豆视频网站| 中文字幕国产一区二区| 国产乱码精品一区二区三区av | 欧美激情一区二区三区蜜桃视频| 日本女人一区二区三区| 欧美午夜精品理论片a级按摩| 中文av一区特黄| 国产suv精品一区二区6| 日韩女优制服丝袜电影| 日韩精品欧美成人高清一区二区| 一本色道久久综合狠狠躁的推荐| 中文字幕一区二| 99精品黄色片免费大全| 国产精品久久久久久久浪潮网站 | 欧美成人国产一区二区| 亚洲高清免费观看| 欧美日韩精品三区| 亚洲一区二区三区国产| 91福利在线免费观看| 亚洲最新在线观看|