不知不觉必须要用WINSOCKAPI开始编程了.自己还不懂用的方法.
甚至连那些函数都不懂.
想请大家帮忙弄WINSOCKAPI的函数的用法和一个普通的例子就可以了...
如果有教程 当然就更好了.
现贴WINSOCKAPI的基本函数....大家帮忙啊,不说话就代表这里没人来了...
Declare Function getsockname Lib "ws2_32.DLL" (ByVal s As Long, sname As sockaddr, namelen As Long) As Long
Declare Function WSAStartup Lib "ws2_32.DLL" (ByVal wVR As Long, lpWSAD As WSADataType) As Long
Declare Function WSACleanup Lib "ws2_32.DLL" () As Long
Declare Function bind Lib "ws2_32.DLL" (ByVal s As Long, addr As sockaddr, ByVal namelen As Long) As Long
Declare Function accept Lib "ws2_32.DLL" (ByVal s As Long, addr As sockaddr, namelen As Long) As Long
Declare Function socket Lib "ws2_32.DLL" (ByVal af As Long, ByVal s_type As Long, ByVal protocol As Long) As Long
Declare Function WSASocket Lib "ws2_32.DLL" Alias "WSASocketA" (ByVal af As Long, ByVal s_type As Long, ByVal protocol As Long, lpProtocolInfo As Any, ByVal g As Long, ByVal dwFlags As Long) As Long
Declare Function closesocket Lib "ws2_32.DLL" (ByVal s As Long) As Long
Declare Function connect Lib "ws2_32.DLL" (ByVal s As Long, addr As sockaddr, ByVal namelen As Long) As Long
Declare Function gethostbyname Lib "ws2_32.DLL" (ByVal host_name As String) As Long
Declare Function gethostbyaddr Lib "ws2_32.DLL" (addr As Any, ByVal nlen As Long, ByVal ntype As Long) As Long
Declare Function gethostname Lib "ws2_32.DLL" (ByVal host_name As String, ByVal namelen As Long) As Long
Declare Function recv Lib "ws2_32.DLL" (ByVal s As Long, Buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long
Declare Function recvfrom Lib "ws2_32.DLL" (ByVal s As Long, Buf As Any, ByVal buflen As Long, ByVal flags As Long, from As sockaddr, fromlen As Long) As Long
Declare Function send Lib "ws2_32.DLL" (ByVal s As Long, Buf As Any, ByVal buflen As Long, ByVal flags As Long) As Long
Declare Function sendto Lib "ws2_32.DLL" (ByVal s As Long, Buf As Any, ByVal buflen As Long, ByVal flags As Long, to_addr As Any, ByVal tolen As Long) As Long
Declare Function htonl Lib "ws2_32.DLL" (ByVal hostlong As Long) As Long
Declare Function htons Lib "ws2_32.DLL" (ByVal hostshort As Long) As Integer
Declare Function ntohs Lib "ws2_32.DLL" (ByVal netshort As Long) As Integer
Declare Function ntohl Lib "ws2_32.DLL" (ByVal netlong As Long) As Long
Declare Function inet_addr Lib "ws2_32.DLL" (ByVal cp As String) As Long
Declare Function inet_ntoa Lib "ws2_32.DLL" (ByVal in_n As Long) As Long
Declare Function setsockopt Lib "ws2_32.DLL" (ByVal s As Long, ByVal level As Long, ByVal optname As Long, optval As Long, ByVal optlen As Long) As Long
Declare Function setsockopt2 Lib "ws2_32.DLL" Alias "setsockopt" (ByVal s As Long, ByVal level As Long, ByVal optname As Long, optval As Any, ByVal optlen As Long) As Long
Declare Function getsockopt Lib "ws2_32.DLL" (ByVal s As Long, ByVal level As Long, ByVal optname As Long, optval As Long, optlen As Long) As Long
Declare Function getsockopt2 Lib "ws2_32.DLL" Alias "getsockopt" (ByVal s As Long, ByVal level As Long, ByVal optname As Long, optval As Any, optlen As Long) As Long
Declare Function listen Lib "ws2_32.DLL" (ByVal s As Long, ByVal backlog As Long) As Long
Declare Function WSAIoctl Lib "ws2_32.DLL" (ByVal s As Long, ByVal dwIoControlCode As Long, lpvInBuffer As Any, ByVal cbInBuffer As Long, lpvOutBuffer As Any, ByVal cbOutBuffer As Long, lpcbBytesReturned As Long, lpOverlapped As Any, lpCompletionRoutine As Any) As Long
Declare Function WSAEnumProtocols Lib "ws2_32.DLL" Alias "WSAEnumProtocolsA" (ByVal lpiProtocols As Long, ByVal lpProtocolBuffer As Long, lpdwBufferLength As Long) As Long
Declare Function WSAGetLastError Lib "ws2_32.DLL" () As Long
Declare Function WSACreateEvent Lib "ws2_32.DLL" () As Long
Declare Function WSACloseEvent Lib "ws2_32.DLL" (ByVal hEvent As Long) As Boolean
Declare Function WSAEventSelect Lib "ws2_32.DLL" (ByVal s As Long, ByVal hEventOjbect As Long, ByVal lNetWorkEvents As Long) As Long
Declare Function WSAEnumNetworkEvents Lib "ws2_32.DLL" (ByVal s As Long, ByVal hEventOjbect As Long, lpNetWorkEvents As WSANETWORKEVENTS) As Long
Declare Function WSAWaitForMultipleEvents Lib "ws2_32.DLL" (ByVal cEvents As Long, lphEvents As Long, ByVal fWaitAll As Boolean, ByVal dwTimeOUT As Long, ByVal fAlertable As Boolean) As Long
Declare Function WSAResetEvent Lib "ws2_32.DLL" (ByVal hEvent As Long) As Boolean
Declare Function WSAEnumNameSpaceProviders Lib "ws2_32.DLL" Alias WSAEnumNameSpaceProvidersA" (lpdwBufferLength As Long, ByVal lpnspBuffer As Long) As Boolean
[此贴子已经被作者于2006-8-5 8:25:49编辑过]