Windows recv method usage

Posted by vandamon taigi on Programmers See other posts from Programmers or by vandamon taigi
Published on 2013-10-18T13:07:55Z Indexed on 2013/10/18 16:12 UTC
Read the original article Hit count: 195

Filed under:
|
|

I'm making a multiplayer game and I have an issue with the recv function ( or the send one , not sure ).

Server side code :

        char* UserName = new char[256];
        ZeroMemory(UserName,256);
        recv(sConnect,UserName,256,0); // works

        char* Password = new char[256];
        ZeroMemory(Password,256);
        recv(sConnect,Password,256,0); // works 


        users[ ++usercount ] = new Client(UserName,Password,sConnect);

        if( users[usercount] ->GetLogInSuccesful() )
            send(sConnect,"0x0001",6,0);  // debugging shows it gets here and sends the data.

Client side code :

        send(server->getsConnect(),User,256,0); // works
        send(server->getsConnect(),Pass,256,0); // works
        char* Response = new char[6];
        ZeroMemory(Response,6);
        recv(server->getsConnect(),Response,6,0); // gets stuck here.

Any ideea why does it get stuck on that recv ? I also tried by making response [256] or such.

© Programmers or respective owner

Related posts about c++

Related posts about Windows