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?
ping from different node
Collapse
X
-
Tags: None
-
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?Comment
-
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?Comment
-
Thanks for your reply..
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..Code:iphe =Dns::Resolve(s); Console::WriteLine(S"Host Entry :{0}",iphe->HostName->ToString()); IPAddress* ipad = __try_cast<IPAddress*>(iphe->AddressList[0]); Console::WriteLine(S"IP Address : {0}",ipad->ToString()); IPEndPoint* ipe = new IPEndPoint(ipad,80); EndPoint* senderRemote = __try_cast<EndPoint*>(ipe); Console::WriteLine(S"Sender Remote :{0}",senderRemote->ToString()); DateTime dt=DateTime::Now; int iRet; st->SetSocketOption(SocketOptionLevel::Socket,SocketOptionName::IpTimeToLive,32); st->SetSocketOption(SocketOptionLevel::Socket,SocketOptionName::SendTimeout,500000); Byte RecvByte[]=new Byte[256]; iRet=st->ReceiveFrom(RecvByte,RecvByte->Length,SocketFlags::None,&senderRemote); TimeSpan ts=DateTime::Now -dt; if(iRet==-1) { Console::WriteLine(S"Error Getting Data"); } Console::WriteLine(S"Reply From :IP={0,-20} TTL={1,-10} Time={2,3}ms",senderRemote->ToString(),RecvByte[8].ToString(),ts.Milliseconds.ToString());
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..Comment
-
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,th e reply comes from 172.20.20.6 which is the server.Sometime s 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 73Comment
Comment