Why does SDL_net send and receive byte by byte?

Greetings SDL developers,
I would just like to ask a simple question: why does the SDL_net support
library send and receive packets byte by byte? I know that it makes sure
that someone doesn’t receive only a partial packet, but why byte by byte
when you could merely subtract the number of bytes sent from the total to be
sent and loop until that’s 0?

Regards,
Electro

2009/3/16 Mak Naze?i?-Andrlon

Greetings SDL developers,
I would just like to ask a simple question: why does the SDL_net support
library send and receive packets byte by byte? I know that it makes sure
that someone doesn’t receive only a partial packet, but why byte by byte
when you could merely subtract the number of bytes sent from the total to be
sent and loop until that’s 0?

Regards,
Electro


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I assume you mean a TCP socket as a UDP socket would not make sense in that
context. What makes you think this is the case? I just had a quick look at
the trunk and see the following which does what you are requesting,

do {
	len = send(sock->channel, (const char *) data, left, 0);
	if ( len > 0 ) {
		sent += len;
		left -= len;
		data += len;
	}
} while ( (left > 0) && ((len > 0) || (errno == EINTR)) );

2009/3/16 Mak Naze?i?-Andrlon :

Greetings SDL developers,
I would just like to ask a simple question: why does the SDL_net support
library send and receive packets byte by byte? I know that it makes sure
that someone doesn’t receive only a partial packet, but why byte by byte
when you could merely subtract the number of bytes sent from the total to be
sent and loop until that’s 0?

As far as I know, you’re completely crazy. SDL_Net has never had this
behavior. What has caused you to think that it does this?–
http://codebad.com/

Ugh. I need more sleep. I saw a 1 instead of left the other night, so, yeah,
I’m probably completely crazy. Sorry to bother you for this.

2009/3/17 Donny Viszneki <donny.viszneki at gmail.com>> 2009/3/16 Mak Naze?i?-Andrlon <@Mak_Nazecic-Andrlon>:

Greetings SDL developers,
I would just like to ask a simple question: why does the SDL_net support
library send and receive packets byte by byte? I know that it makes sure
that someone doesn’t receive only a partial packet, but why byte by byte
when you could merely subtract the number of bytes sent from the total to
be
sent and loop until that’s 0?

As far as I know, you’re completely crazy. SDL_Net has never had this
behavior. What has caused you to think that it does this?


http://codebad.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

2009/3/17 Mak Naze?i?-Andrlon

Ugh. I need more sleep. I saw a 1 instead of left the other night, so,
yeah, I’m probably completely crazy. Sorry to bother you for this.

hey i am not having anyone stealing my craziest / laziest / stupidist person
crown on SDL lists