Introduction

API Winsock

Exemple
Ecrivez-moi

En partenariat avec amazon.fr

WSASTARTUP

 
Initialisation de Winsock.dll
Declare Function WSAStartup Lib "wsock32" _
	(ByVal wVersionRequired As Integer, _
	 wsData As WSA_DATA) As Long

Paramètres :

wVersionRequired : version de Winsock voulue

wsData : pointe sur la structure WSA_DATA

Public Const WSADESCRIPTION_LEN = 256
Public Const WSASYS_STATUS_LEN = 128
Type WSA_DATA
    wVersion As Integer
    wHighVersion As Integer
    strDescription(WSADESCRIPTION_LEN + 1) As Byte
    strSystemStatus(WSASYS_STATUS_LEN + 1) As Byte
    iMaxSockets As Integer
    iMaxUdpDg As Integer
    lpVendorInfo As Long
End Type
 	 
retour : 0 si OK, erreur sinon

Exemple :

Dim CR as long
Dim wsadata As WSA_DATA

CR = WSAStartup(&H101, wsadata)
If CR <> 0 Then
    MsgBox "Mauvaise version de Winsock.dll"
    Exit Sub
End If