|
We are simulating a web cache server using sockets,where
1.a client submits a url from his m/c
2.Request reaches server in the form of successive Http req headers.
3.Server processes each and sends corresp page to client..
The problem we encounter is this..
When the consecutive requests arrive on d same socket..we get a "debug assertion failed" message in sockcore.cpp
BOOL CAsyncSocket::Accept(CAsyncSocket& rConnectedSocket,
SOCKADDR* lpSockAddr, int* lpSockAddrLen)
{
ASSERT(rConnectedSocket.m_hSocket == INVALID_SOCKET);//the debugger points to dis line!!!!!
.....
......
}
We havent used multithreading!
Do we need to use it,or creating multiple sockets would help?
Do we need to post d code snippet?
|
|
|
|
|
You probably are reusing a CAsyncSocket object in a loop. If so, you need to close it before reusing. Try to call Close member after processing each request.
|
|
|
|
|
thanks for the suggestion..We tried it..
but another problem dat surfaces is dat we are not able to decide where exactly to close the socket...this is because our socket recieves consecutive requests..n these should be processed/served in succession.
So if we close it,the 2nd immediate request isnt served,while the later ones are..
Do we attach a snippet here 4 more clarity??
|
|
|
|
|
I think you should call Close not for the socket which executes Accept , but for the socket that is passed to Accept as a parameter. That socket must be closed (or must be a new one) before calling Accept . This is required by MFC.
|
|
|
|
|
We did just that....still the same problem...
|
|
|
|
|
I use Microsoft visual studio.net2003. When internal lib such as Vfw32.lib was used in my programm, there are some errors. The error code is LNK2019. I analysis it may be caused by the internal lib not including in enviroment.
Please give me some suggestions about how to slove the problem .Thanks.
-- modified at 0:15 Monday 12th June, 2006
|
|
|
|
|
Open up your project and under the Project properties go to linker>general
There you will find a entry for additional library directories.
Add vfw32.lib over there.
In your file where you are calling the functions from the library
#include "vfw.h"
//I hope that this solves out your problem
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 1:25 Monday 12th June, 2006
|
|
|
|
|
Hi,
Can anyone guide me how to change the Menu font size either in coding or design time? The default font style and font size are "MS San Serif" and "8 points" respectively. I would like to change to "Tahoma" and "10 points". Any help out there. Thank you.
Wilson
|
|
|
|
|
|
Can't find any solution out there!
|
|
|
|
|
|
You have to go for ownerdraw menu.
- NS -
|
|
|
|
|
As others have said, use an owner-drawn menu. It's not too difficult.
However, unless your application really needs to do this, I'd recommend not doing it. Users have the ability to set their preferences in Windows how they want them, and it's generally frowned upon to go messing with them (including deliberately doing something different).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hey all,
i have a really simple question, im amazed i cant find out how to do this.
i have 2 integers, called x and y . i need to show printf("%d", (x/y));
everything i try will round it to the closest integer. i've tried using double for x,y, another variable that stores the value of x/y, but it still rounds the to the closest integer. how can i display a number not rounded to the closest integer?
thanks in advance
|
|
|
|
|
|
If both of the numbers are of type int like they stated then you'll get (On Visual C++ 6.0 and VC++ 2003)
#include "stdafx.h"
int main(int argc, char* argv[])
{
int x=1;
int y=9;
printf("%f\n",x/y); // The expression gets truncated before formatting
printf("%lf\n",x/y); // The expression gets truncated before formatting
printf("%f\n",(double)x/y); // The correct way when both are integers
printf("%lf\n",(double)x/y); // The correct way when both are integers
return 0;
}
*************** OUTPUT VC++ 6.0*******************
-1.#QNAN0
-1.#QNAN0
0.111111
0.111111
Press any key to continue
*************** OUTPUT VC++ 6.0*******************
796482944349676280000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000.000000
796482944349676280000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000
000000000000000000000000000000.000000
0.111111
0.111111
Press any key to continue
|
|
|
|
|
Don't forget to make sure at least one of the components in the expression is a float or a double to avoid truncations. If both x and y are int's you will notice a truncation of the result before the printf formatting occurs.
printf("%f\n",(double)x/y);
|
|
|
|
|
See
<br />
double c;<br />
double x = 123.456;<br />
double y = 2.1;<br />
c=x/y;<br />
printf( "%f\n", c);
whitesky
|
|
|
|
|
|
One slight correction: Use the "%f " format code for values of type float , and "%lf " format code for values of type double .
Software Zen: delete this;
|
|
|
|
|
anybody knows how to repair a floppy??Plz giv some implementation..
|
|
|
|
|
Do you want to create this utility or just need a tool for doing this
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I am already in the rocess of makin this utility ,but some ppl say that they move bad sectors in damaged floppies!! How can we do that? We can just indicate the OS that the sector is bad ,we cant move it here n there around.So I just wanted to confirm this thing. I hav tried my programs on several floppies n 8/10 hav been suceessfully repaired .But anyways Thanks .
|
|
|
|
|
|
Hey , Listen
CFlopy is just to read from a floppy , onthing else OK. It is not a floppy repairer . If u dont know the answer ,then stop guessing.
|
|
|
|