Socket Error

06/15/2013 20:29 inc_p0int#16
You should better learn the basics instead of developing a pserver.
06/15/2013 22:17 artfulwave#17
Quote:
Originally Posted by inc_p0int View Post
You should better learn the basics instead of developing a pserver.
Quote:
Originally Posted by ernilos View Post
The client works perfectly, isn't coded by me(I'm developing p.server) ><
She/He is right...And i think if you have coded the whole project yourself you would have known what`s the problem.
For which game are you developing this P.S. ?
Provide more info to get help.
06/15/2013 22:35 szymek111#18
Quote:
Originally Posted by artfulwave View Post
She/He is right...And i think if you have coded the whole project yourself you would have known what`s the problem.
For which game are you developing this P.S. ?
Provide more info to get help.
NosTale.
06/16/2013 01:00 ernilos#19
I have all algorythm's working perfectly, litlle crashes i know how works all packets etc… but idk why i can't recv all packet from the client just need fix it :I
06/16/2013 20:30 Padmak#20
I think you need to buffer the incoming packets and process them everytime some new packets arrive.
Like this:
Code:
int rcv = recv(.. &buf...);
if(rcv > 0)
{
    nw_buf.push_back(buf, rcv);
    packethandler(nw_buf);
}

void packethandler(buf_type bf)
{
    while(process_packet(bf) != TOO_SHORT)
    {
        packethandler(bf);
    }
}
It's some ugly pseudo-code but i think it'll help you to get the gist of what i'm trying to say

Padmak
06/16/2013 21:36 Master674b#21
Quote:
Originally Posted by Padmak View Post
I think you need to buffer the incoming packets and process them everytime some new packets arrive.
Like this:
Code:
int rcv = recv(.. &buf...);
if(rcv > 0)
{
    nw_buf.push_back(buf, rcv);
    packethandler(nw_buf);
}

void packethandler(buf_type bf)
{
    while(process_packet(bf) != TOO_SHORT)
    {
        packethandler(bf);
    }
}
It's some ugly pseudo-code but i think it'll help you to get the gist of what i'm trying to say

Padmak
What? Normally you got a TCPClient class which holds a socket, just do an async_read of like 4 bytes for the packet opcode and call your handler and let the handler read more from the socket if he needs it.