|
I modified the server "send" with data length +1.
The exception does not occur.
Thanks very much, Mark!
I have a few questions:
1. The message eg. equals "abc". Its length is 3.
Why should I send its length as 4?
(The server is checked to send data within the length of CATOS_BUFFER_SIZE.)
2. The recv buffer is allocated with 1 more byte for safe (may be it is a risk...)
My design is that if CATOS_BUFFER_SIZE==10 and message comes from the server as "1234567890", it can hold the message. Indeed, a terminator is at the end (here is '0'). If '\0' is padded by the server, it can still hold the message.
'\0' is padded automatically for initializing an char array.
Please advise if my analysis is wrong.
3. If the server is checked to send data within the length of CATOS_BUFFER_SIZE, is it possible that the client recv() may receive the message sereral times instead of once?
I mean: recv() holds the application (thread). 'several times' refers to 1 recv() receives a part of the message, several recv() receives all message 'packages'.
Please advise.
|
|
|
|
|
Archyami wrote: 1. The message eg. equals "abc". Its length is 3.
Why should I send its length as 4?
(The server is checked to send data within the length of CATOS_BUFFER_SIZE.)
I don't think you SHOULD send 4. I was just trying to fix your exception before. If you
have 3 bytes to send then send 3 bytes
Archyami wrote: 2. The recv buffer is allocated with 1 more byte for safe (may be it is a risk...)
My design is that if CATOS_BUFFER_SIZE==10 and message comes from the server as "1234567890", it can hold the message. Indeed, a terminator is at the end (here is '0'). If '\0' is padded by the server, it can still hold the message.
'\0' is padded automatically for initializing an char array.
Please advise if my analysis is wrong.
If you want to send the '\0' WITH the string of characters "1234567890" then you need to
send 11 bytes. It is up to YOU to send and receive the correct amount of bytes.
Archyami wrote: 3. If the server is checked to send data within the length of CATOS_BUFFER_SIZE, is it possible that the client recv() may receive the message sereral times instead of once?
I mean: recv() holds the application (thread). 'several times' refers to 1 recv() receives a part of the message, several recv() receives all message 'packages'.
I'll try to explain this again...TCP knows NOTHING about "packages" or "packets" - it only
knows a STREAM of bytes. You can send 1000 bytes and on the other end you may receive
all 1000 bytes in one call to recv(), you may receive 10 bytes in one call to recv() and
990 bytes in the next call to recv(), etc.. It's all about BYTES and it's up to you keep
calling recv() until you get the number of bytes you are expecting.
If you always want to recv the same number of bytes you send then you need to use a
message/datagram based protocol like UDP.
I suggest reading this Windows Sockets 2[^].
Mark
|
|
|
|
|
Hi all,
How to add a work sheet in excel without using ODBC drivers?
|
|
|
|
|
|
when i am trying to add new ATL object but after clicking that option it will give error
"Error Invoking ATL Object Wizard Component"
And when i have tried this to other machine then also i got error like
"sorry !an error occurred while generating the object
Can anybody help me here why this error are coming how to solve it
|
|
|
|
|
|
Does this help?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear all
how to add a class which don't attach .cpp and .h files?i can't understand their project.thank u. urgent!!!!!!!
Li Zhiyuan
18/10/2006
|
|
|
|
|
Usually a class is declared in .h file and defined in a .cpp file, but it is possible to do this in a single file, if thats what you mean. The only other way I know of to add a class (without using source files) is to add a dll to the project. But even here it is difficult to export a class without the relevent header file.
|
|
|
|
|
Can you be more specific a class without cpp & h
|
|
|
|
|
li zhiyuan wrote: how to add a class which don't attach .cpp and .h files?
You can't. A class has to be in one or the other, but usually split between the two.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
To preserve thread integrity, you might want to respond to Li instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
oh dear, I though I did.
Fixed and deleted original message
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
We need more info.
If you send us the details of the project your university has given you, then we may be able to help but without further information, we cannot.
i.e. Exactly what was the question being asked ?
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Hi All,
I have a CListCtrl in report view with images. Whenever an Item gets highlighted, I lose the image.
Can anyone tell me how to keep the image from dissapearing?
P1p3r
|
|
|
|
|
How are you setting the item's image?
I_IMAGECALLBACK or an index into your image list?
|
|
|
|
|
Hi Mark,
Thanks for the info.
I finally figured it out. I had set the color wrong when I created the image.
Thanks again.
P1p3r
|
|
|
|
|
I'd make sure that the mask in the imagelist is correct. The most common way is to have a unique color in the bitmap that becomes transparent when drawn on the screen.
|
|
|
|
|
Hi Michael,
Thanks for the heads up.
I guess that's what I needed.
|
|
|
|
|
I come from the managed world and have no idea about unmanaged dlls!
So, I have a few unmanaged dlls I want to interop with using pinvoke, etc...
However, these dlls are undocumented so I have no idea, what parameters the methods take, or return.. I don't even know what methods are in the dll at all!
How can I peek into the unmanaged dll to see a signature of the methods? I've been messing around with dependency walker and pe explorer and those enable me to see what methods are inside the dll but neither of them provide information regarding the parameters or return types.
Am I just using them wrong? How can I get this information?
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: However, these dlls are undocumented so I have no idea, what parameters the methods take, or return.. I don't even know what methods are in the dll at all!
How do you know you want to interop with them then?
Mark
|
|
|
|
|
I JUST know...
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote: I JUST know...
Fair enough
I don't think there's any requirement that calling parameters be exported from a dll.
If you can even see the names you are lucky. They could just be ordinals
You need to get your hands on header and def files!
Mark
|
|
|
|
|
Oh, ok, header (.h) files, thanks for pointing me in the right direction
/\ |_ E X E GG
|
|
|
|
|