|
while( true )
{
cout<<"Send: ";
cin>>szBuffer;
send( client, szBuffer, sizeof(szBuffer), 0 );
if( strcmpi(szBuffer,"exit") == 0 ) break;
}
if szBuffer is something like "Hello world"
then the server recieves the string in two parts
the first being "Hello" and the second being "world"
so i think you get my point, it seems to be breaking the data by spaces and sending each word
it may be appending the space too, (havnt tested)
now i want it to send "Hello world" all at once instead of by each word, i thought about replacing the spaces with something else, but i dont really want to do that
anyone know what i can to do to solve this?
|
|
|
|
|
Take a look at the WSARecvEx routine - it will tell you if the received message is a partial message.
Steve
|
|
|
|
|
Look at the line
send( client, szBuffer, sizeof(szBuffer), 0 );
I presume szBuffer is comething like LPTSTR , LPSTR , TCHAR * or char * , in which case, the sizeof operator will return the size of the pointer, not the buffer. You need to pass in the size of the buffer, or use strlen (may be vulnerable to buffer overflows).
--
Andrew.
|
|
|
|
|
actually, szBuffer is defined as
TCHAR szBuffer[512];
notice its not defined as a pointer,
im not stupid, if it were defined as a pointer then
sizeof(szBuffer) would return 4
but since its not a pointer it should return 512
how did you get that line to show up with a tan background?
i have tried [code]somecode[/code] before it doesnt seem to work
|
|
|
|
|
> im not stupid,
Are you sure? TCHAR szBuffer[512] makes szBuffer a pointer, without a subscript it is synonymous to saying &szBuffer[0]...
Being rude won't get you any help in these forums. Hope that was useful.
--
Andrew.
|
|
|
|
|
»Archer282« wrote:
how did you get that line to show up with a tan background?
i have tried [code]somecode[/code] before it doesnt seem to work
»Archer282« wrote:
im not stupid
How do you reconcile these two comments ?
Code blocks are easy, if you have the ability to read ( hint: check the formatting links below if you can't work it out for yourself ).
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
remember this:
send(client,szBuffer,strlen(szBuffer),0); // so use strlen when sending
recv(server,szBuffer,sizeof(szBuffer),0); // so use sizeof when receiving
gabby
|
|
|
|
|
I have problem with drawing PNG with alpha channel using DrawImage. It works fine if I draw on screen but when I am using off-screen buffer all pixels which are transparent are drawn in black. Strange thing is that if I insert another DrawImage before this first everything starts working again. Apparently this additional DrawImage changes state of Graphics object. I dumped CompositingMode, CompositingQuality, SmoothingMode and etc before and after this magical DrawImage but all values are the same before and after this first call to DrawImage.
Does anybody know what is changed in Graphics object when DrawImage is called?
Regards,
Damian
|
|
|
|
|
Damian2 wrote:
It works fine if I draw on screen but when I am using off-screen buffer all pixels which are transparent are drawn in black
Probably because the memory bitmap you are drawing to is all black before anything is drawn, but the screen is white. Do a FillRectangle with a white brush before calling DrawImage.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I clear this off-screen buffer with Graphics.Clear on the beginning. This is not the reason
|
|
|
|
|
Ok, then post your code here. How are you allocating your memory buffer? How are you loading your image file?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Reading all the articles about hooks I've found out how to monitor keyboard input but is there a way to disable key combinations on this level of interception? For example when windows is hooked by my program and user presses Shift+Insert I wouldn't like the text to be inserted from the clipboard but do some other actions. And vice versa how can I emulate different key combinations presses?
|
|
|
|
|
As you said that it is possible using keyboard hooks (as you said there are lots of artciles on codeproject)... I think I have disabled the ctrl+alt+del in one my applications and instead of restarting it was calling my About Dialog...
Well... I am a beginner ...
|
|
|
|
|
Use GetAsyncKeyState API to determine whether Shift or Control buttons were pressed.
|
|
|
|
|
Once I have created a dialog using DoModal() is it possible at runtime to make it a modeless dialog after a button has been pressed???
Thanks
How do I print my voice mail?
|
|
|
|
|
How about instead always creating a modeless dialog and calling its behaveAsModal() method to make it behave as a modal/modeless dialog?
void CMyDialog::behaveAsModal
(bool bModal)
{
GetParent()->EnableWindow (!bModal);
} Remember to call behaveAsModal (false); when the user dismisses the dialog, otherwise there will be no way to transfer control back to the parent dialog.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
it's for a shell extension so I imagine the parent is the desktop...
Would that be a good idea still do you think?
How do I print my voice mail?
|
|
|
|
|
Ah. Then you probably don't want to use a modal dialog (unless you intentionally require it to be system modal).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i m trying to program a parallel port and i just want to ask inport and outport functions are in which library
|
|
|
|
|
|
Hi Everyone!
I need a help. I am in proces of development of Instant Messenger and Conferencing Tool. What I need is a support for proxy Server Also.
Like if you are behing Wingate Proxy and you want to Use the option for proxy Setting.
Like in MSN --> Tools --> options --> Connection --->
I want all the feature of this page.
Let me know if any one can help me. I will be really grateful.
Thank and Regards
Irfan Haider Jaffery
Software Engineer
|
|
|
|
|
Irfan, these articles may provide some help:/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have been using g++ to compile C++ programs in Linux but I just got Visual Studio .NET so I have been trying to use that. When I go create a new C++ project is visual studio, however, I cant figure out which option I'm suppose to pick. Programs that worked with g++ don't work when I add them to my Visual C++ projects?? Does anyone know which Visual C++ project to create for regular C++ programs?
Another problem I am having with Visual C++ is when I try to overload constructors. Client is a user defined class I created and when I create a instance of it with:
Client c(int num, int age, int entered, char sex, int value);
and then call:
c.print();
it says that c must be a class/struct/union.
I have a pverloaded constructor with matching parameters and there is no compile error for the initialization of c so why does it say its not a class?
Thanks in advance.
|
|
|
|
|
linjc23 wrote:
I have been using g++ to compile C++ programs in Linux but I just got Visual Studio .NET so I have been trying to use that. When I go create a new C++ project is visual studio, however, I cant figure out which option I'm suppose to pick. Programs that worked with g++ don't work when I add them to my Visual C++ projects?? Does anyone know which Visual C++ project to create for regular C++ programs?
I suspect you want "Win 32 Console Project"
Kevin
|
|
|
|
|