socket.reacive

naama

Member
Joined
Dec 17, 2019
Messages
9
Programming Experience
Beginner
i've open a raw socket for icmp packet with Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Icmp);
then i bind it with IPAddress.Any
i've send request packet to my computer ip("192.168.1.29")
i know the packet was reacive due to wireshark put i can't get the packet with s.reacive using VS
the only way i can get the packet is if i'am binding the socket to "192.168.1.29" and then adding the option of
s.IOControl(IOControlCode.ReceiveAll, byTrue, null);
it's problematic since then my program is more or less acting as sniffer and i can't send back icmp packet using sendTo.
help whould be appreciate
 
Line 7 to 10 does not make sense.

A listener (which is essentially what you need) is meant to listen for traffic from ALL ip addresses, so why set a new endpoint with a custom IP on line 10?

I suggest looking at the Socket link above, for an idea of how one should be written. Take the docs provided and use the sample source. Ensure it works and then edit it to suit your needs. Also, If you're trying to use low level APIs to get around problems your network is causing, its your network you should be configuring, and not leaning on low level APIs as a fix.
Line 7 to 10 does not make sense.

A listener (which is essentially what you need) is meant to listen for traffic from ALL ip addresses, so why set a new endpoint with a custom IP on line 10?

I suggest looking at the Socket link above, for an idea of how one should be written. Take the docs provided and use the sample source. Ensure it works and then edit it to suit your needs. Also, If you're trying to use low level APIs to get around problems your network is causing, its your network you should be configuring, and not leaning on low level APIs as a fix.
Ive tried using reacive instead of reacive from with the same reasult
 
It's curious that someone back in 2009 was experiencing the same problem trying to receive ICMP packets, and the problem seems to only have started with Vista based on some of the responses.
 
It's curious that someone back in 2009 was experiencing the same problem trying to receive ICMP packets, and the problem seems to only have started with Vista based on some of the responses.
I read that but unforthantly the solution they suggested isnt relavant here.
Adding the recive all they basicaly created a sniffer. I try to tunnel tcp packet over icmp. Meaning i have to send ping back from the server to the client.
It is not possible with reacive all if the server and client connect to the same router(the server sniff its on packet).
I also dont work with vista both my computer has windows 10
 
I was just trying to point out that the issue with ICMP receives started with Vista and has gone onwards. Prior to that, things worked in XP.
 
Back
Top Bottom