I am trying to initialize sockets in my code with the following:
Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired As Long, ByVal lpWSADATA As WSADATA) As Long
Public Const WS_VERSION_REQD As Long = &H101S
Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
SocketsInitialize = WSAStartup(WS_VERSION_REQD, WSAD) = ICMP_SUCCESS
If SocketsInitialize = False Then
MsgBox(Err.LastDllError)
End If
SocketsInitialize = True
End Function
The WSAStartup fails with the err.lastdllerror code returned is 126. Does anyone have any idea what I am doing wrong? This worked in VB6 but I am now running VB.net.
Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired As Long, ByVal lpWSADATA As WSADATA) As Long
Public Const WS_VERSION_REQD As Long = &H101S
Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
SocketsInitialize = WSAStartup(WS_VERSION_REQD, WSAD) = ICMP_SUCCESS
If SocketsInitialize = False Then
MsgBox(Err.LastDllError)
End If
SocketsInitialize = True
End Function
The WSAStartup fails with the err.lastdllerror code returned is 126. Does anyone have any idea what I am doing wrong? This worked in VB6 but I am now running VB.net.