|
Has same problem. Ping1() does not work with admin privilege.
|
|
|
|
|
Have same problem. Ping1() does not work with admin privilege.
|
|
|
|
|
Have same problem.
"An attempt was made to access a socket in a way forbidden by its access permissions."
Anyone know if there is a way to use raw sockets when running as a limited user in XP SP2?
|
|
|
|
|
I am testing after delte ICMP echo option on windowsXP service pack2.
CPing can't receive Ping Echo.
Teach me..How to receive Ping Echo On windowsXP(with service pack2)
|
|
|
|
|
Just tested the latest version from my web site at www.naughter.com on XP SP2 and I see know problems. I'd suggest you download the latest version and run the code under the debugger to see what is happening. Also have a look at the html documentation which comes with the download
|
|
|
|
|
I am using MFC Socket classes in my project so I'm including afxsock.h header file. When I try to insert the CPing class I must include winsock2.h also, and I get serveral redefinitions. How can I fix these problems?
Thanks.
|
|
|
|
|
The MFC socket classes uses Winsock 1.1 and my raw sockets ping use Winsock 2.0. I'm not really sure how you would go about combining the two in one program (or in fact if you should). I suggest you ditch one or the other. For example use the ICMP version in the ping class. You can exclude the winsock 2 method in my class via a preprocessor directive of "CPING_NO_WINSOCK2". Also try putting winsock2.h before your afxsock.h include.
|
|
|
|
|
How do i get the time it took to go to the server and ping it? The rTTL has been the same everytime I used it.
-Steven
CP Addict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
First thing to do is make sure you have the latest version from my web site (www.naughter.com) as this class is now up to v1.32. Also remember on a lan that ping times can be < 10 ms, which is below the nominal timer resolution on Windows 2000 / XP.
|
|
|
|
|
Hi,
After I sorted out the problem of my previous Error 87 (which had been caused by one of the #define new DEBUG_NEW in ping.cpp) I now have the following behavior:
When I try to ping the ftp.download.com I get 11013 back, whereas my ping on the commandline says it can ping it well.
Why is this ? Any idea ?
PS: I'm currently building this as a small example for a PowerBuilder nonvisual extension (PBNI)
|
|
|
|
|
I had a look for this error in the SDK includes, you will see in winerror.h:
// MessageId: WSA_QOS_BAD_OBJECT
//
// MessageText:
//
// Problem with some part of the filterspec or providerspecific buffer in general.
//
#define WSA_QOS_BAD_OBJECT 11013L
Which I'm not sure what that means. I'd suggest you search in the MSDN or Google for references to this. Also I will disable any QOS drivers you have on that machine and see what happens.
|
|
|
|
|
Is there a way to get a better error message ?
I'm looking eg. for what is errorcode 87.
|
|
|
|
|
Just look the error up in the SDK include file "winerror.h". Here it is:
//
// MessageId: ERROR_INVALID_PARAMETER
//
// MessageText:
//
// The parameter is incorrect.
//
#define ERROR_INVALID_PARAMETER 87L // dderror
Also debug through the code to see where the code is failing.
|
|
|
|
|
i want to retrieve the IP address of the machine using VC++
calls
|
|
|
|
|
Not that it is related to my ping class, but just use gethostname followed by gethostbyname
|
|
|
|
|
When the packet size set to 1024 bytes the defined maximum size, there are an error occurred with lack of recv buffer.
I think the meaning of packet size makes confused. The packet size should be included the ICMP header, so the code of buffer allocation might be as follows,
CPing:Ping2(....)
{
....
//Allocate the ICMP packet
char* pICMP = new char[nPacketSize];
FillIcmpData((LPICMP_HEADER) pICMP, nPacketSize);
......
//allocate the recv buffer
int nRecvBuf = nPacketSize + sizeof(IP_HEADER);
char* pRecvBuf = new char[nRecvBuf];
......
nRead = recvfrom(sockRaw, pRecvBuf, nRecvBuf, 0, (sockaddr*)&from,
&nFromlen);
.....
}
=======================================================================
When the packet size set to 8 the defined minimum size, there is also an error occurred. Because the sizeof(ICMP_HEADER) is 12 not 8.(because of the non standard field ULONG timestamp;) So the FillIcmpData() will overwrite the buffer.
|
|
|
|
|
The 'IP VERSION' and 'IP HEADER LENGTH' should be 4 bits not 4 bytes.
typedef struct tagIP_HEADER
{
unsigned char h_len:4; // length of the header
unsigned char version:4; // Version of IP
....
}
|
|
|
|
|
They are. Make sure you have the latest version from my web site at www.naughter.com
|
|
|
|
|
Hi,there
How to change the time interval?
I find a sentence : sleep(1000); Is this one?
I hope to change to 10 minutes as the time interval.
And when I build the ping.exe,one error occured:
_beginthreadex undeclaired identifier
How to correct it?
Thanks a lot!
XYZ
|
|
|
|
|
Looked at the code and there is no sleep calls in it. Make sure you have the latest version from my web site. As for the _beginthreadex, you need to add MFC to your app.
|
|
|
|
|
Friend,
How to get ws2_32.lib for win9x. With out this my project is also not working under win9x. So please give some link from where i can find ws2_32.lib
|
|
|
|
|
The LIB file is part of your development environment and not the OS. Install the latest Platform SDK to get this
|
|
|
|
|
I'm pretty sure that most lib files from the Platform SDK are not legally distributable, so the only legit way of getting this file is to install the Platform SDK. Being a professional developer, downloading a file like this from this type of web site is just asking for trouble.
|
|
|
|
|
// Seems to work on all Windows platforms:
bool CSETINetDlg::Ping(LPCTSTR szServer)
{
char szCommandLine[1024];
sprintf(szCommandLine, "ping.exe -n 1 %s", strServer);
STARTUPINFO StartupInfo;
ZeroMemory(&StartupInfo, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_HIDE;
PROCESS_INFORMATION ProcessInfo;
DWORD dwExitCode;
if (CreateProcess(NULL, szCommandLine, 0, 0, FALSE, CREATE_NO_WINDOW, 0, 0, &StartupInfo, &ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess, 1000);
GetExitCodeProcess(ProcessInfo.hProcess, &dwExitCode);
return dwExitCode == 0;
}
return false;
}
Joep Oude Veldhuis
|
|
|
|
|
What can I say? Maybe it's easier for you to open a dos box and type the ping command. The whole idea is to show how to write a ping program, not how to call a ping program that someone else wrote.
|
|
|
|