I keep getting error code 10057
Code:
#include <windows.h>
#include <winsock.h>
#include <string>
#include <iostream>
#pragma comment(lib, "Ws2_32.lib")
int main ()
{
int iResult;
WSADATA wsa;
WSAStartup(MAKEWORD(2,2), &wsa);
SOCKET s = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
struct sockaddr_in client;
char text[] = "12345";
client.sin_family = AF_INET;
client.sin_addr.s_addr = inet_addr("_PRIVATE_");
client.sin_port = htons( 27015 );
iResult = connect( s, (SOCKADDR*)&client, sizeof( client ) );
iResult = send( s, text, strlen( text ), NULL );
std:: cout << WSAGetLastError() << std:: endl;
}
UPDATE:
turns out the connection was refused, need to add error checking. -_-