473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ping from different node

i'm doing icmp implementation in vc++.net 2003.when i receive icmp packets, it comes from the different system..what is the reason?is it correct?
Jun 17 '08 #1
6 1916
Plater
7,872 Expert 4TB
The icmp packet should be coming from someone else yes.
Did you look at the docs on icmp?
Jun 17 '08 #2
Reply comes from the node different from what i am expected.

When i gave ping 172.20.20.23, reply comes from other system...is it correct

or not?
Jun 18 '08 #3
Plater
7,872 Expert 4TB
Well they get changed.
If a series of devices are connected, where lowercase is a computer and uppercase are routers:

a - B - C - d

If you ping d from a, your icmp response will come from B, since each packet gets stopped on the way I believe.
I *think* this is what you are seeing. Another explanation could be a byte order mistake, like you think you're pinging one address but really it's different one due to a byte order mistake?
Jun 18 '08 #4
Thanks for your reply..

Expand|Select|Wrap|Line Numbers
  1. iphe =Dns::Resolve(s); 
  2.         Console::WriteLine(S"Host Entry :{0}",iphe->HostName->ToString()); 
  3.         IPAddress* ipad = __try_cast<IPAddress*>(iphe->AddressList[0]);
  4.  
  5.         Console::WriteLine(S"IP Address : {0}",ipad->ToString()); 
  6.         IPEndPoint* ipe = new IPEndPoint(ipad,80);
  7. EndPoint* senderRemote = __try_cast<EndPoint*>(ipe);
  8.         Console::WriteLine(S"Sender Remote :{0}",senderRemote->ToString());  
  9.  
  10. DateTime dt=DateTime::Now;    
  11.         int iRet;
  12.         st->SetSocketOption(SocketOptionLevel::Socket,SocketOptionName::IpTimeToLive,32);
  13.         st->SetSocketOption(SocketOptionLevel::Socket,SocketOptionName::SendTimeout,500000);
  14. Byte RecvByte[]=new Byte[256]; 
  15.               iRet=st->ReceiveFrom(RecvByte,RecvByte->Length,SocketFlags::None,&senderRemote);
  16.                TimeSpan ts=DateTime::Now -dt;
  17.             if(iRet==-1)
  18.             {
  19.                     Console::WriteLine(S"Error Getting Data"); 
  20.             }
  21.             Console::WriteLine(S"Reply From :IP={0,-20} TTL={1,-10}  Time={2,3}ms",senderRemote->ToString(),RecvByte[8].ToString(),ts.Milliseconds.ToString());   
  22.  
this is my code..here before i got reply from the destination,the IP address is printed correctly.But after i getting reply the destination address has changed..

My assumption is.. the packet from the destination comes through different node..the actual reply is from the actual destination..


Another problem is i am getting very late response...even i ping my node response is very late.what is the reason for that?can i minimize the response time?

i'm awaiting for your reply..
Jun 19 '08 #5
Plater
7,872 Expert 4TB
What happens when you ping with a regular ping command in windows?
Or use the actual ping implementation in .NET?

If you do a traceroute to that same address, does the "next hop" have the ip address you are seeing on the return of YOUR ping?
Jun 19 '08 #6
In Regular ping commad, the response comes immediatly.I used the actual ping implementaion.

When i checked the IP datagram header,the TTL always 128.If the packet comes from the different node, TTL field might be decremented by 1 or 2.but in my case the TTL always 128.

Here is my output of my program.I displayed first 60 bytes of the returning IP packet.when i send ping 172.20.20.24,the reply comes from 172.20.20.6 which is the server.Sometimes the reply comes from other IP address

IP Address : 172.20.20.24

Data Sending to 172.20.20.24:80

Reply From :IP=172.20.20.6:0 TTL=128 Time=213ms

69 0 0 60 148 184 0 0 128 1 37 190 172 20 20 6 172 20 20 28 0 0 65 94 2 0 20 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 65 66 67 68 69 70 71 72 73
Data Sending to 172.20.20.24:80

Reply From :IP=172.20.20.6:0 TTL=128 Time=213ms
69 0 0 60 148 186 0 0 128 1 37 188 172 20 20 6 172 20 20 28 0 0 64 94 2 0 21 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 65 66 67 68 69 70 71 72 73
Data Sending to 172.20.20.24:80

Reply From :IP=172.20.20.6:0 TTL=128 Time=758ms
69 0 0 60 244 161 0 0 128 1 197 212 172 20 20 6 172 20 20 28 0 0 63 94 2 0 22 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 65 66 67 68 69 70 71 72 73
Data Sending to 172.20.20.24:80

Reply From :IP=172.20.20.6:0 TTL=128 Time= 71ms
69 0 0 60 244 163 0 0 128 1 197 210 172 20 20 6 172 20 20 28 0 0 62 94 2 0 23 0 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 65 66 67 68 69 70 71 72 73
Jun 21 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Alexandre Plennevaux | last post by:
hello ! I would like to measure the time a user needs to connect to my website. In other words, to perform a ping between my website and the user's computer. I'm scratching my head as to how...
1
by: Mike Mallory | last post by:
Can Java perform two pings at one time and display the best ping time with the best result? Also, can Java perform two trace routes at one time and display the trace with the fewest hops? ...
3
by: Jason Rodman | last post by:
I have downloaded every example on how to create a ping utility in .Net in both VB and C#, but have been disappointed with the results. I have YET to find an example that returns consistent results...
2
by: Eric Wenger | last post by:
I'm pretty new to C# and I'm trying to do what I believe should be a simple thing. I want to modify a program that is using the System.Net.NetworkInformation.Ping class to have some custom...
21
by: Neel | last post by:
I am trying to "ping" a remote host in my C++/Redhat Linux code to check whether that host is connected or not. if (0 == system("ping -w 2 192.168.0.2)) But, in both cases...
7
by: luvwknd | last post by:
Hi all, I am attempting to utilize MS's article I.D. #828993 found at: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B828993 In an effort to create a GUI Ping utility that...
5
by: Sonda | last post by:
how to ping ip address from c language ?
1
by: bngboun | last post by:
How can I write a remote ping code in C#? I have tried some basic ping codes, but the thing I am required to is I think different than the simple ping. I think I have to make an IP(can be my IP,...
1
by: Mauro \Baba\ Mascia | last post by:
Hi, this is my question: I want to know if several switch (about 50) in a big lan are up and then know their MAC addresses to do a list that contains host name, ip and mac. I know only the range...
1
by: somsub | last post by:
Can any one help me on ping command . for this line of code ($ret, $duration, $ip) = $p->ping ($line) If i give any 1> invalid entry as a parameter ($line) in ping command or
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.