// Declaration socket
WSADATA WSAData;
SOCKET sock;
SOCKADDR_IN sin;	

// Initialisation socket
WSAStartup(MAKEWORD(2,0), &WSAData);

sin.sin_addr.s_addr= inet_addr("127.0.0.1"); // Adresse IP
sin.sin_family= AF_INET;
sin.sin_port= htons(4001);  // Port
sock = socket(AF_INET,SOCK_STREAM,0);
bind(sock, (SOCKADDR *)&sin, sizeof(sin));

// Si connection etablie
if (connect(sock, (SOCKADDR *)&sin, sizeof(sin)) == 0)
{
// Declaration socket
WSADATA WSAData;
SOCKET sock;
SOCKADDR_IN sin;	

// Initialisation socket
WSAStartup(MAKEWORD(2,0), &WSAData);

sin.sin_addr.s_addr	= inet_addr("127.0.0.1"); // Adresse IP
sin.sin_family		= AF_INET;
sin.sin_port		= htons(4001);  // Port
sock = socket(AF_INET,SOCK_STREAM,0);
bind(sock, (SOCKADDR *)&sin, sizeof(sin));

// Si connection etablie
if (connect(sock, (SOCKADDR *)&sin, sizeof(sin)) == 0)
else

// Fin
closesocket(sock);
WSACleanup();