|
No problem, just checking the obvious first. At least somebody does the right thing
What line was the error on? I've never used the MFC socket classes - I prefer to use the Winsock APIs directly (I've done most of my sockets programming under Unix/Linux ). I might be able to pick out some problems if you can tell me the file/line number though.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
Thanks Ryans,
File: sockcore.cpp
Line: 567
It was in the original post (I stepped through the code) and the problem appears to be in ...\SOCKCORE.CPP starting at line 563 (the Line: 567 CAsyncSocket::FromHandle(...) part).
#ifdef _DEBUG
void CAsyncSocket::AssertValid() const
{
CObject::AssertValid();
ASSERT(m_hSocket == INVALID_SOCKET || CAsyncSocket::FromHandle(m_hSocket) != NULL);
}
Any news may be good news !!
I am happy to send the Client and the server projects to anyone who may be able to assist!!
cheers Will Beattie
|
|
|
|
|
It certainly looks like an internal library error. MFC maintains a map of socket handles to CAsyncSocket/CSocket objects. What this error is saying is that your socket handle is not mapped to a socket CAsyncSocket or CSocket object. If you're only using MFC socket classes, then it must be, and it's not being placed into the map properly. You might like to trace through from when you create (or accept, if it's an accepted socket) the socket, and see if it's being placed into the socket map.
Other than this, I can't help any more.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
If this assertion fires randomly, i.e. it fires sometimes and especially when the connection is being or is closed, then please read further. Otherwise just ignore me.
Actually this is an internal error and I don't think you're doing anything wrong at all. If it works fine in the release build, than that's it. I believe this is caused by the bad habit of abortive closing of the socket. The CAsyncSocket is a cumbersome implementation of winsock (and CSocket is much much worse) in which it uses hidden windows to receive asynchronous notifications and sometimes fails badly to handle the case, especially in abortive closures as I've mentioned. My assumption is that some window message(s) will get received after the socket has been closed and this assertion fires. Eventually it's not only that assertion on Line 567, there are many more you could face.
Networking is chaotic due to the nature of connectivity and it's almost impossible to reproduce the problem, so that's why this assertion sometimes fires and sometimes does not and that's why I never succeeded in finding out the reason of the CAsyncSocket asserts. Though I'm not getting them that frequently (by the time of writing this I've noticed, I haven't got one since a month! I must have done something..) I've given up. Just blame it on Microsoft and everything's fine again.
Btw. CSocket and CAsyncSocket should really really be derived from CWnd. So, bad design + verygoodgodlikewhatever programming -> bad implementation.
|
|
|
|
|
How is it possible to put a bimap on a button??
Pls help
San
|
|
|
|
|
Definitely! One solution is to add the bitmap into project resources. Load it and the button via SetBitmap().
Kuphryn
|
|
|
|
|
|
How can I use CString format the string like "12,123.23" thanks
|
|
|
|
|
CString str;
str.Format(_T("Floating point: %.2f"), 12345.12345);
-Nick Parker
|
|
|
|
|
Sorry, that I want to receive is 12,345.12 .thanks.
|
|
|
|
|
float fVal=12345.12;<br />
CString tmp;<br />
tmp.Format("%.2f",fVal);<br />
if(tmp.GetLength()>6)<br />
tmp.Insert(tmp.GetLength()-6,',');<br />
|
|
|
|
|
Or, you could use the W32 GetNumberFormat() and GetCurrencyFormat() apis, which gives you much more flexibility.
onwards and upwards...
|
|
|
|
|
Hi friends,
I want to know how a Network Management Product gets the details of all the machines in a network. Even the SNMP agent is disabled still it is able to learn about the product and give it's complete details of client computers (like description,mac and os etc). How is that possible?? Anybody got some clues??
Suggest me.
Regards
Satya
|
|
|
|
|
Probably uses NetBios calls. See Netbios in the doc for more info.
onwards and upwards...
|
|
|
|
|
Or the NetServerEnum function.
onwards and upwards...
|
|
|
|
|
Anyone know how to convert a CString into LPDISPATCH and back? I'm trying to integrate with a VB program that takes an LPDISPATCH which I have as a CString. Any other ideas on how to get the job done are very welcome!!
ed
|
|
|
|
|
I don't get your situation. LPDISPATCH is an IDispatch* , in other words, a pointer. There is no useful conversion between a pointer and a string, unless you want to know the address held in the pointer.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
I'm not sure I 'get' my situation either!
The program I'm writing the plugin for is in VB. I've generated a class from their dll derived from COleDispatchDriver. I'm getting an XML response from a server which I'll parse to get a report and rather than saving it out to disk the client wants the results stored in their system. Here is the signature:
long SaveDataStream(LPCTSTR strJobID, LPCTSTR strKey, LPDISPATCH inStream, BOOL * blnPublic)
I'm using MFC. Their documents say an ADO Stream object however they said it would read any stream but I'm not sure about what they mean by stream.
Thanks!!
ed
|
|
|
|
|
Hi,
How can I verify if SP 5 is installed with Visual C++ 6 ?
Thanks,
Claude
|
|
|
|
|
check this registry location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\6.0\ServicePacks
There you should see a string value sp5 REG_SZ.
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
when i trace the following code,the value of "size" is alwarys 4 instead of 14,
why?
int size;
char *str;
str = (char*)malloc(128);
sprintf(str,"string1\
string2")
size = sizeof(str);
gucy
|
|
|
|
|
First of all, you know you're using C, not C++, right ?
4 is the size of a 32 bit number, i.e. the number which stores the memory address where your string lives. You're looking for strlen, I believe. Or use C++ instead, for example std::string or CString if you're using MFC ( or ATL in VC7, I believe ).
Of course, if you're learning, it is indeed better that you understand what the string classes do for you, but sizeof is the wrong approach, it's strlen you want.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
The sizeof keyword gives the amount of storage, in bytes, associated with a variable or a type. Which means that in your case your are getting the size of str which is nothing but a pointer. A pointer stores a memory location, which is only 4 bytes. If you truly want to get the size in bytes of your string that you should try this:
size = sizeof(char) * strlen(str)
// Afterall, I realized that even my comment lines have bugs
|
|
|
|
|
Hi,
We create a Trial.txt & a Trial.mdb (using FTP to transfer) and put them on our Web-Page (\database\...). We are able to use VC++ 6.0 to link to our Web Page & read the Trial.txt by the following codes:
<br />
pConnect = pInetSession->GetFtpConnection (strServerName, "xxxxxxxx", "pppppppp", nPort, FALSE);<br />
<br />
pFile = pConnect->OpenFile ("Database/Trial.txt",.......);<br />
<br />
pFile->Read (str, 100 ,...)<br />
*) The problem is: I do not know what command to open the Trial.mdb ... does anyone show me how to do it?
Many thanks
Anh
|
|
|
|
|
Hello again!
How can each button have its own width like on the IE toolbar? I added some text to my buttons and they all take their width from the widest button...
Thanks!
---------------
Tired of Spam? InboxShield 2.0 is now available for Microsoft® Outlook® 2K/2K2/2K3
http://www.inboxshield.com
|
|
|
|