|
Thanks for the language thing...can you please tell the dependencies etc..i am unable to compile ur code..i used iphlpi.h and its lib file in link..but still it is not compiling and can you message the IPS issued from this code..I shall be highly obliged if u can revert back asap..
thanks in advance..
Himanshu
|
|
|
|
|
The only dependency is iphlpapi.lib which comes with Platform SDK I guess, you should download & install it if you haven't already done so. If it gives a linker error then that's the case, if not could you please paste the error lines?
When I run this on my computer I get two IP addresses, cause I have two ethernet adapters: one for my LAN and one for my cable connection to the Internet. Back to your question, a dialup adapter is a virtual adapter and thus if the ISP has assigned an IP to your computer via DHCP, you should get it in that loop as well. In your case, if the host computer has more than one IP address such as mine, you should have your own way of differentiating it from the other IP addresses, such as checking for the type of the adapter, looking for a name etc...
Sorry for the late response, I've been sleeping all day
|
|
|
|
|
Hi,
Thanks for ur sooner reply..I dont have any errors now..but I cannot understand the parameters to be passed..CString& rszHostName,CString& rszHostIPAddress, int nIPSelection..please guide.and reply soon..I shall be waiting for ur response. Thanks a ton in advance..
Himanshu
|
|
|
|
|
Hi Himanshu,
Sorry but I really don't think that I do understand. Weren't you asking for the IP address of the local computer? Now say that's the rszHostIPAddress parameter. What are the other two? You've mentioned above you needed a function which receives no parameters, now you want to pass parameters to it?
The method I've described above let's you get the IP addresses assigned to a computer, note that whilst a computer has a single hostname, it can have many IP addresses. And that about nIPSelection, I really don't understand, sorry...
|
|
|
|
|
I am running VC++ Vn 6.0 SP5 and am writing a program using multiple threads with CSockets. I am having problems i.e.
Popup Dialog with:
Microsoft Visual C++ Debug Library
Debug Assertion Failed!
File: sockcore.cpp
Line: 567
This type of problem is documented on MSDN in an article "Q193101" acknowledging a bug in the static library. MSDN SP5 has a fix(?) for this and suggests adding "AfxSockInit()" to each each thread that uses sockets. I have done this and I am not getting assertions in the Release exe but I am still getting them in the debug version.
Do I need new debug libraries, or should I just ignore the assertions - this is a "pita".
suggestions welcome
whybotha69@hotmail.com
// the last C bug
if (missilesDetected());
LaunchCounterAttack();
|
|
|
|
|
Debug assertions are used in the MFC library to indicate when the programmer has used the library in the wrong way, ie. you are doing something wrong. Run your app in debug mode and when the assertion comes up, hit debug, and try to trace what is actually causing the error. 99.9% of the time it's because you have made a mistake in your program and are using the library the wrong way.
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 for the comment, but I did all that and found the (mentioned) MSDN article. It was after exhausting all these avenues that I turned here !!
|
|
|
|
|
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
|
|
|
|