|
Sounds like a problem with the executable's (PE) header to me...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
there is a problem about CSocket in multithread programing.
I have a class inherited from CWinThread.In the main program, I post a thread message to the thread class member(CMyThread object for example)to start a thread.I have create and block a socket object(Accept function).
When I want to end the main program,I want to end the thread ture.Whether I use CancelBlockingCall or not,there would be an assert occured.From the message ,I know,it asserted in sockcore.cpp at line 337:ASSERT(pState->m_hSocketWindow != NULL);
Why? someone would help me!Thanks
|
|
|
|
|
I recommend you to not use CSocket, use CAsyncSocket instead and read this[^] article in order to get it right.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I know what you mean.but I only want to using this thread samply and soon,that I have no time left.
The thread only must to listen all the connection from the client,and reply.
I think I would have a look on this artical after two days,when I had handed in my product.
Thanks.
|
|
|
|
|
kcynic wrote: I have no time left
Ok, but that implies that you also don't have time for bugs or undesired behaviour, right?
The MSDN documentation clearly states that cancelling a socket which is inside a blocking call will "terminate as soon as possible". Which means that you may find yourself waiting for a timeout. Whether that's acceptable or not is for you to decide, but if it's not you should use CSyncSocket instead.
Regarding your original problem: your secondary thread is a UI-thread, right?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
No,the thread is a work thread which only accept connections from clients and reply them.And the thread belong to a GUI window,when the window is been terminated,the exception would occur! I think the reason is that the socket remain blocking or active.
|
|
|
|
|
kcynic wrote: I think the reason is that the socket remain blocking or active.
You're probably right.
Using CAsyncSocket would get you out of that trouble.
Since you're probably accessing the socket from multiple threads, there could be a problem with accessing the correct underlying handle.
How do you transfer the socket between threads?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks for your help.
I will have a try,but if there remain some problem,I wish I could gain help from you again.
|
|
|
|
|
kcynic wrote: Thanks for your help.
You're welcome.
kcynic wrote: I will have a try,but if there remain some problem,I wish I could gain help from you again.
Simply post your question and most likely someone will pick up your thread and help you.
I try to stay of the boards on weekends though and I suspect a major part feels the same way.
Have a nice weekend!
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hi all
i want lock a directiry but i don't know how do its
plz help me
thanks alot
bye
|
|
|
|
|
mahideh wrote: i want lock...
Meaning what exactly?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
I have declared two enums:
enum ANICTG1 { DOG = 1, CAT = 2 };
enum ANICTG2 { LION = 1, TIGER = 2 };
ANICTG1 a1;
ANICTG2 a2;
if i get a1 value, How can i assign a1 to a2?
Whether static_cast a better way to use?
Thank you all.
|
|
|
|
|
In my opinion you should avoid this because it doesn't make sense.
Consider having an enum with days of the week and another with months
typedef enum
{
Sunday = 1,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
} Weekdays_t;
typedef enum
{
Januari = 1,
Februari,
March,
April,
May,
June,
Juli,
August,
September,
October,
November,
December
} Months_t
It wouldn't make sense to assign Januari to a weekday in my book, even if the value (1) is the same. It would be confusing for anyone that reads the code later.
If you should have some kind of mapping between two enums, I suggest you at least map it in a switch-case statement.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hi guys... can you help me with my problem?
i have this C project with its source codes... i can compile it using vs2005 and run the program... what i want is to do is to make a dll out of it since some projects are compiled as .lib and some are .exe... so i set the configuration properties>configuration type to .dll.. but i get this errors:
Error 83 error LNK2001: unresolved external symbol ___ckd_calloc__ mdef.obj
and many more of this things...
so any answers why this happens to me? thanks
|
|
|
|
|
I think so this is not complete info, can you write some more more information, as which method are you calling and what sort of log is in the output window, are you calling any function *calloc* and is mdef.c or mdef.cpp is included in your project.
Best Regards,
Mushq
|
|
|
|
|
hi i am new to vc++ and i strucked at a point i hope people will clarify it asap.
problem;
currently i am involved in gui part and my job is .....i have to display the images of the devices(pc's) or atleast the names of the devcies that comes in to network in server (control point ) pc.
i mean devices may come into network at any point of time and whenever a device comes in to network at server side gui i ahve to display the aimge or atleast the name of the image (dynamically)
can anyone suggest how i can do this...dynamic linking of images .
please tell in brief so that a beginner can understand that....
and also suggest some sites/ebooks that can help me.
thanks in advance,
g.ravi
|
|
|
|
|
Hi,
When I'm debugging my project I'm getting a access violation error like the following
Unhandled exception at 0x12bb8c3 in [exe]: 0xC0000005:
Access Violation Reading Location 0xbaadf00d
Any help on this would be highly appreciated.
Thanks
|
|
|
|
|
You haven't given enough information such as a stack trace and the line which causes the crash. See here[^] for a possible hint regarding 0xbaadf00d.
Steve
|
|
|
|
|
This is the trace that I get in Output window. Note that I'm copying the debug versions of exe and dll into my installition folder of my appplication.
exit: CHPAiOTrayAppPlugIn::FinalConstruct
[tid:0x09FC] Status: Name=<all-in-one>, GUID=<{BB80D457-8331-4AD4-BAC5-447B5855C71A}>
[tid:0x09FC] Status: CreateP:
Unknown error
[tid:0x09FC] Exit: CreateP hr=(0x80040154) Class not registered
[tid:0x09FC] Status: LoadPFromRegistry:
Unknown error
[tid:0x09FC] Exit: LoadPFromRegistry hr=(0x80040154) Class not registered
[tid:0x09FC] Entry: BeginPInitialization
First-chance exception at 0x012bb8c3 in a.exe: 0xC0000005: Access violation reading location 0xbaadf00d.
Unhandled exception at 0x012bb8c3 in a.exe: 0xC0000005: Access violation reading location 0xbaadf00d.
The program '[924] a.exe: Native' has exited with code 0 (0x0).
|
|
|
|
|
A stack trace would be useful. And the source code around the problem with the line in question marked.
Steve
|
|
|
|
|
>>Access violation reading location 0xbaadf00d.
That still cracks me up. The first time I saw that in the debugger long ago, I thought it
was a coincidence.
0xBAADF00D, 0xDEADC0DE, 0xDEADBEEF, etc.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Yeah, it's pretty funny. See here[^] for some more.
Steve
|
|
|
|
|
tom groezer wrote: Access violation reading location 0xbaadf00d.
0xbaadf00d is a good indication that you are trying to access heap memory that is uninitialized.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
In general the best way to solve this kind of problems is to use your debugger: check where the code crashes and put breakpoints to evaluate the different variables around the crash to check if they contain what you expect.
|
|
|
|
|
I have debugged and from the stack trace it looks it that there is some problem with registeration of the coclass.
|
|
|
|