About Store Forum Documentation Contact



Post Reply 
structnoobness or wrong netcode interpretation?
Author Message
krystianity Offline
Member

Post: #1
structnoobness or wrong netcode interpretation?
Hey Guys, thanks for checking by...

I am working on this for probably 3 days now and I just cant get this to work. All I am actually trying is putting the code from the Netcode Simple Connection Server Tutorial into classes/structs...however my server doesnt broadcast any packets to the clients, and whenever a client connects to the server he gets kicked after about 10 seconds.

I am actually rather disappointed of myself for being stuck on this T_T

I have uploaded the small source as attachment.

Thanks in advance for your help blushing

greets chris
Ah, furthermore I ve forgot to mention that my server has stopped kicking the clients, but whenever I send a packet he crashes now. :/


Attached File(s)
.zip  NetworkingTest.zip (Size: 2.4 KB / Downloads: 10)
(This post was last modified: 10-06-2012 08:47 PM by krystianity.)
10-06-2012 08:41 PM
Find all posts by this user Quote this message in a reply
rwrz Offline
Member

Post: #2
RE: structnoobness or wrong netcode interpretation?
Hello,

I dont know too much about EE yet.
But I'm studying your problem and isnt this cast wrong?

Code:
if(Client* client = dynamic_cast<SVClient*>(&mServer->clients.lockedData(i)))

I think it should be:

Code:
if(SVClient *client=CAST(SVClient, &mServer->clients.lockedData(i)))

Maybe thats why it is freezing...

Cya,

RW
10-10-2012 04:03 PM
Find all posts by this user Quote this message in a reply
krystianity Offline
Member

Post: #3
RE: structnoobness or wrong netcode interpretation?
Thanks for your help, but the server still crashes as he receives a packet.
10-10-2012 05:26 PM
Find all posts by this user Quote this message in a reply
rwrz Offline
Member

Post: #4
RE: structnoobness or wrong netcode interpretation?
I think I have found! hehe

Code:
for(int i = 0; i <= Elms(mServer->clients); i--)
{
    if(Client* client = dynamic_cast<SVClient*>(&mServer->clients.lockedData(i)))
    {
        if(this != client)
        {
            connection.data.pos(0);
            client->connection.dataFull(connection.data, connection.data.size());
        }
    }
    mServer->clients.unlock(); // THIS ONE
}

This line:
Code:
    mServer->clients.unlock(); // THIS ONE

Should be outside the FOR...

Code:
    }
}
mServer->clients.unlock(); // THIS ONE

You are unlocking the clients, before the FOR finishes.

Try that.

RW
10-10-2012 05:40 PM
Find all posts by this user Quote this message in a reply
krystianity Offline
Member

Post: #5
RE: structnoobness or wrong netcode interpretation?
Thanks a lot for your help grin
Damn...my own fault, I didnt want to use the macro and while
splitting the REPA I forgot the new { I opened.

smile
10-14-2012 10:52 AM
Find all posts by this user Quote this message in a reply
Post Reply