All pastes #340611 Raw Edit

Stuff

public cpp v1 · immutable
·published 2007-02-04 21:58 UTC
rendered paste body
void MakeConnection(){    int rSocket;    char Host_Name[40] = "localhost";     WSAData wsaData;     int ErrorCode;     struct hostent *host_entry;         ErrorCode = WSAStartup(MAKEWORD(2,2),&wsaData);               if (ErrorCode == SOCKET_ERROR)                  {                            client->gui->MBox("Couldn't start Winsock !",clBox);                            WSACleanup();                                    }              rSocket = socket(AF_INET,SOCK_STREAM,0);           if (rSocket == SOCKET_ERROR)              {                 client->gui->MBox("Couldn't open the socket !",clBox);              }           host_entry = gethostbyname(Host_Name);          if (host_entry = NULL)     {        client->gui->MBox("Couldn't find the host !",clBox);      } struct sockaddr_in sNfo;     sNfo.sin_family = AF_INET;    sNfo.sin_addr.s_addr = *(unsigned long*) host_entry->h_addr;    sNfo.sin_port = htons(5252);        ErrorCode = connect(rSocket,(sockaddr*)&sNfo,sizeof(sNfo));     if (ErrorCode == SOCKET_ERROR)     {                   client->gui->MBox("Couldn't connect !",clBox);                          }                                                                       }