How do I know how large the data is when returned by recv? I can't use lstrlen of the data packet return cause It would stop at the NULL character right? :)

Is there a way to determine the amout of data returned?
Also, is there a way to work with non null-terminated string (length defined) string when adding it to say an edit control?
Posted on 2003-05-16 00:14:25 by xkardisx
You're kidding, right?
Posted on 2003-05-16 00:27:46 by iblis
im not lol

i see recv, and the data return length is always user defined :P unless everyone code poorly. so no way eh? i am teh nae smart lol
Posted on 2003-05-16 00:55:57 by xkardisx
but i take it from ur comment i msis something, like recv returnin the length of data received lol in eax i suppose will have to see right now ;p
Posted on 2003-05-16 00:57:54 by xkardisx
Okay, if recvs on success returns the bytes received why is there a user defined length for the buffer? And what is the maximum buffer length?
Posted on 2003-05-16 00:59:09 by xkardisx
On second thought, I suppose there are cases where the programmer only want partial bytes rececived.
Posted on 2003-05-16 00:59:42 by xkardisx
better to make a fool of myself then not! least im learning, im gonna go back to my first stragedy with search first read etc. lol, i guess i got carry away with all the easy helping as of late
Posted on 2003-05-16 01:00:33 by xkardisx
Believe it or not, I actually read the articles written about winsockets, but I guess when you're trying to figure some other things out, you sort of forget what you read since at the very moment, your trying to get a certain part of the winsock to work which is not relative to what you will need later! :) Put a dune hat on me.

After rereading what I previous read, its obvious. :)
Posted on 2003-05-16 01:12:38 by xkardisx
First of all, use the edit button instead of posting 5 replies in 5 minutes.

Okay, if recvs on success returns the bytes received why is there a user defined length for the buffer?

Because you might receive less bytes than the given buffer size.

Also, is there a way to work with non null-terminated string (length defined) string when adding it to say an edit control

Add a null terminator at the end.

I suggest you read some tutorials (there's a winsock tutor on my site), this is pretty basic stuff so it will probably help.

Thomas
Posted on 2003-05-16 01:13:11 by Thomas
Hey Thomas,

I've actually visisted your site, and read your tutorials. Some of it is the basis for what I've written so far. However, having worked on my project on and off, on my free time, and when things gets boring, I've not yet managed to digest everything. Things once known, gets forgotten in the dulls of time, or rather, lack of practice to reinforce it. I remember now, and feel like a dope, that recv returns the length but I guess it skipped my mind since I've been spending a couple hours to get one particular thing to work.

I'll make sure to use the Edit button more often. I just do not like to edit my post, to update any error I've made, (unless it need to be corrected, in term of useful source). Even though it may not help others much, someone may find themselves asking the same thing, see my errors, and see the fixes suggested so that is one of the reason I don't. But you are right, I could of edited or deleted many of the posts I've made (as you noticed the 5-6 post with 2-3 sentences at most).

Thanks for everything you two. I will continue to read and reread the tutorials, and do more extensive searching, before I ask more silly questions. :)

Oh and Thomas, yes, I know you can add a NULL terminated character so it works with api or functions that require a string to have one. The problem was that there are many null terminated characters, from the data packet, but now that I know how to get the length, I can just replace all the NULLS with 20h except the last character (which should be NULL). :)
Posted on 2003-05-16 01:27:30 by xkardisx