   WSAStartup failed null
  Ok, I get WSAStartup failed <null> what does that error mean? I've never seen it before.....-Reason for not posting code: I don't feel the need to do so at the moment I am just looking to find out what that error means....   
  To the best of my knowledge, WSAStartup doesn't print or report anything, it just returns error code. So whatever is generating that error is your error printing routine.And if it returns 0 (closest to null), then it means it succeeded. Or there is some formatting problem with error printing routine.   ;  my error printing is like this....printf("WSAStartup(): failed %s\n", WSAGetLastErorr);an with that I get....WSAStartup(): failed <null>;  That's obviously not the code you use, since that wouldn't even compile. In addition, WSAGetLastError returns an integer error code, not a string.Besides, WSAGetLastError doesn't work with WSAStartup (because if WSAStartup fails, the structures used by WSAGetLastError aren't even set up yet). Instead, WSAStartup returns the error directly.I would say the error is related to what you're passing into WSAStartup, so I think we'll have to see code anyway (in general, you should always assume that we'll need to see code, people cannot read minds. Even if you post code that's not directly related to the problem, post something so that we have some idea what's going on)   ;Quote:Original post by ARC incmy error printing is like this....printf("WSAStartup(): failed %s\n", WSAGetLastErorr);an with that I get....WSAStartup(): failed <null>You are passing function pointer to WSAGetLastError, which printf tries to interpret as C-style string.   ;  WSAGetLastError() returns an integer, not a string. It returns 0 for "no error", which also happens to be the value for a null pointer. printf() is able to cope with that (In debug mode at least, I don't know about release), and prints "<null>" instead of crashing the application.In addition, if WSAStartup() fails, it returns the error; it's not legal to call WSAGetLastError().You want:WSADATA data;int nError = WSAStartup(MAKEWORD(2, 2), &data);if(nError != 0){   printf("WSAStartup() failed with error %d\n", nError);   return -1;};Quote:Reason for not posting code: I don't feel the need to do so at the moment Clearly, actually posting code would probably have been better...;#include "config.hpp"#include "ergodata.h"#include "server.hpp"#include <stdlib.h>#include <stdio.h>#include <winsock2.h>int startserver(){    int DEFAULT_PORT;    int DEFAULT_BUFFER;    int ErgoServ;    DEFAULT_PORT = static_cast<int>(server_config["port"]);    DEFAULT_BUFFER = static_cast<int>(server_config["buffer"]);    WSADATA wsaData;    ErgoServ = WSAStartup(MAKEWORD(2,2), &wsaData);    if(WSAStartup != 0){   printf("WSAStartup() failed: %d\n", ErgoServ);   WSACleanup();   return 1;    }    SOCKET s = socket(AF_INET, SOCK_STREAM, 5);    if(s == INVALID_SOCKET){   printf("socket(): failed %s\n", WSAGetLastError());   closesocket(s);   WSACleanup();   return 1;    }    sockaddr_in sin;    sin.sin_port =htons(DEFAULT_PORT);    sin.sin_family =   AF_INET;    sin.sin_addr.s_addr =   INADDR_ANY;    if(bind(s,(sockaddr*)&sin, sizeof(sin)) == SOCKET_ERROR){   printf("bind(): failed %s\n", WSAGetLastError());   closesocket(s);   WSACleanup();   return 1;    }    while(listen(s, SOMAXCONN) == SOCKET_ERROR);    SOCKET client;    int lin = sizeof(sin);    client = accept(s,(sockaddr*)&sin, &lin);    char buf[200] = "test\n";    send(client, buf, sizeof(buf), 0);    printf("bytes(): sent %d\n", &buf);    closesocket(s);    closesocket(client);    WSACleanup();}I am still getting the problem....here is the code.   ;Quote:Original post by ARC inc *** Source Snippet Removed ***I am still getting the problem....here is the code.Exactly the same?printf("socket(): failed %s\n", WSAGetLastError());is an error, since it tries to print an int as string, which will likely cause a crash when printf will interpret it as pointer to char.Quote:if(WSAStartup != 0){   printf("WSAStartup() failed: %d\n", ErgoServ);   WSACleanup();   return 1;    }Does this compile? What you want is if(ErgoServ != 0){;  Ok, so I figured out what I was doing wrong.Thanks for the help..but now I am getting a new errorsocket failed: 10043I know what the error means but I can't find what I did wrong...I thought I implented the system right...but i dunno thanks again   