Bonjour,
Voici une partie de mon code :
//--------------------------------------------------------------------
#include <windows.h>
#include <winsock2.h>
//Librairie WS2_32.lib ajoutée au projet.
//Version de winsock à utiliser.
WORD wVersionRequested = MAKEWORD(2, 2);
//Initialisation de l'objet WSA.
//------------------------------
WSADATA wsaData;
//WSAStartup retourne 0 en cas de succès.
int iResult = WSAStartup(wVersionRequested, &wsaData);
if (iResult != 0)
return 0;
//Création du socket.
//-------------------
SOCKET Sock;
Sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
//Test si la création du socket a réussi.
if (Sock == INVALID_SOCKET)
{
int iError = WSAGetLastError();
WSACleanup();
return 0;
}
//--------------------------------------------------------------
la fonction WSAStartup passe avec succès(renvoi 0), c'est au niveau de la fonction "socket" que ça coince.
Le debugger m'envoi le message suivant :
Program received signal (SIGSEGV)
Segmentation fault
Value of iResult:
Previous frame inner to this frame (corrupt stack?)
Puis m'ouvre la fenêtre "back-trace" à laquelle je comprend rien.
WSAGetLastError retourne le code erreur 10014 soit sur MSDN :
- Bad address.
- The system detected an invalid pointer address in attempting to use
a pointer argument of a call. This error occurs if an application
passes an invalid pointer value, or if the length of the buffer is too
small. For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
I don't understand !

please help !
