Question

Well.. I am not really sure what that means, but my systems runs and runs and runs without crying for insufficient memeory...

I guess it has to do with the system error 122, because there is no 122 in the winsock error codes (MSDN)...

Anyone got a clue?...

It occures on a call to getaddrinfo(NULL, /*PortNumber*/, &hints, &pFinal)

EDIT alright... heres more code (having it not commented out, doesn´t make sense, too)

            addrinfo hints, *pFinal = nullptr;
            memset(&hints, 0, sizeof(hints));
            hints.ai_flags = AI_PASSIVE;
            hints.ai_socktype = SOCK_STREAM;
            hints.ai_family = AF_INET;

            if(getaddrinfo(NULL, g_ACCEPTOR_PORT_NUMBER, &hints, &pFinal))
                return ERROR_BIND_SOCKET;

The Problem lies in my g_ACCEPTOR_PORT_NUMBER, which is a class containing

operator const char*()
    {
        std::stringstream ss;
        ss << m_nPortNumber;
        return ss.str().c_str();
    }

do I have to change the conversion operator?... I´d prefer to use this "STRINGINT" so i dont need to save the port number as string and number or convert it explicitly...

Was it helpful?

Solution

The problem is your implementation of operator const char*(). Once that function returns, your stringstream object is no longer valid because it is no longer in scope.

OTHER TIPS

Probably a bad parameter on the getaddrinfo call. Can you post more code?

Type in net helpmsg 122 at a command prompt and you get:

The data area passed to a system call is too small.

getaddrinfo actually returns an error code, which you should test against the values specified in the getaddrinfo documentation

More than likely, the size of the pFinal variable is too small. You'll need to post more code to get a more thorough answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top