1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
| #uselib "Wsock32.dll"
#func WSAStartup "WSAStartup" int, int
#func WSACleanup "WSACleanup"
#func gethostname "gethostname" int, int
#func gethostbyname "gethostbyname" int
#func inet_ntoa "inet_ntoa" int
#define ctype MAKEWORD(%1,%2) ((%1) or (%2) << 8)
dim wsadata, 100
WSAStartup MAKEWORD(1, 1), varptr(wsadata)
if stat not 0 : dialog "WSAStartup関数失敗です", 1 : end
mes "wVersion = " + (wsadata(0) and $FFFF)
mes "wHighVersion = " + (wsadata(0) >> 16)
sdim szDescription, 257
memcpy szDescription, wsadata, 257, 0, 4
mes "szDescription = " + szDescription
sdim szSystemStatus, 129
memcpy szSystemStatus, wsadata, 129, 0, 261
mes "szSystemStatus = " + szSystemStatus
mes "iMaxSockets = " + wpeek(wsadata, 390)
mes "iMaxUdpDg = " + wpeek(wsadata, 392)
sdim szBuf, 256
gethostname varptr(szBuf), 256
mes "\nホスト名=" + szBuf
dim in_addr, 1 : sdim szIP, 256
gethostbyname varptr(szBuf)
dupptr hostent, stat, 16 dupptr tmp, lpeek(hostent, 12), 4 dupptr h_addr, tmp, 4 memcpy in_addr, h_addr, 4 inet_ntoa in_addr dupptr ret, stat, 256, 2 szIP = ret mes "IPアドレス=" + szIP
WSACleanup
|