Last active
December 31, 2015 05:09
-
-
Save toshiyukino/7938831 to your computer and use it in GitHub Desktop.
VBAでソケット通信初期化テスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Declare Function WSAStartup Lib "ws2_32.dll" _ | |
(ByVal wVersionRequested As Long, _ | |
ByRef lpWSAData As WSADataType) As Long | |
Private Const WSA_DESCRIPTIONLEN As Long = 256 | |
Private Const WSA_DESCRIPTIONSIZE As Long = WSA_DESCRIPTIONLEN + 1 | |
Private Const WSA_SYS_STATUS_LEN As Long = 128 | |
Private Const WSA_SYSSTATUSSIZE As Long = WSA_SYS_STATUS_LEN + 1 | |
Private Type WSADataType | |
wVersion As Integer | |
wHighVersion As Integer | |
szDescription As String * WSA_DESCRIPTIONSIZE | |
szSystemStatus As String * WSA_SYSSTATUSSIZE | |
iMaxSockets As Integer | |
iMaxUdpDg As Integer | |
lpVendorInfo As Long | |
End Type | |
Private Declare Function WSACleanup Lib "ws2_32.dll" () As Long | |
Sub test() | |
Dim ret As Long | |
Dim wsaData As WSADataType | |
ret = WSAStartup(&H101, wsaData) | |
Debug.Print "wVersion = " & wsaData.wVersion | |
Debug.Print "wHighVersion = " & wsaData.wHighVersion | |
Debug.Print "szDescription = " & wsaData.szDescription | |
Debug.Print "szSystemStatus = " & wsaData.szSystemStatus | |
Debug.Print "iMaxSockets = " & wsaData.iMaxSockets | |
Debug.Print "iMaxUdpDg = " & wsaData.iMaxUdpDg | |
Debug.Print "lpVendorInfo = " & wsaData.lpVendorInfo | |
Debug.Print "wVersion = " & wsaData.wVersion | |
ret = WSACleanup() | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment