no you should send the length you mean strlen(buffer)
no you should send the length you mean strlen(buffer)
here
you should send its length in bytes.
i got an old program from about a year ago. i was warking on a chat type server. there be alot of code most dealing with threads.
i think.
they thread code be whats mest up. i went to rewrite a section and never finished. but if you read through it should explain most of what i said about phrasing packets.
nm that i cound my old copy that compiles.
http://mywebpages.comcast.net/adivin...les/index.html
Try to help all less knowledgeable than yourself, within
the limits provided by time, complexity and tolerance.
- Nor
that is what strlen does
strlen() returns the number of char's in a null ended string. on some systems a char is more than a byte.
Try to help all less knowledgeable than yourself, within
the limits provided by time, complexity and tolerance.
- Nor
you mean less than a byte?
or which systems do you mean?
>>you mean less than a bye
No, he means more. That happens with all variable sizes. They all depend on the architecture you're using. 16, 32 or 64 bit processors will have different sizes for a lot of vars. It also depends on other things, but I'm not sure what they are.
SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
I say what I say, I mean what I mean.
IDE: emacs + make + gcc and proud of it.
well if is the size that is changed why use sizeof()
when the size may depend on the system the lenght is always the same
Your structure won't be null-terminated, so strlen() would give you a crazy number.Originally posted by pode
well if is the size that is changed why use sizeof()
Accrding to the man page of send(), the size is given in size_t which might be different on windows enviroments, so it doesn't really say bytes or chars, although you usually mean bytes, I think.
SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
I say what I say, I mean what I mean.
IDE: emacs + make + gcc and proud of it.
from msdn cd
virtual int Send(const void* lpBuf, int nBufLen, int nFlags = 0 );
Parameters:
lpBuf
A buffer containing the data to be transmitted.
nBufLen
The length of the data in lpBuf in bytes.
nFlags
Try to help all less knowledgeable than yourself, within
the limits provided by time, complexity and tolerance.
- Nor