[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ICMP socket with Gambas
[Thread Prev] | [Thread Next]
- Subject: Re: ICMP socket with Gambas
- From: Lee <t.lee.davidson@xxxxxxxxx>
- Date: Thu, 26 Jun 2025 22:25:47 -0400
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On 6/26/25 4:50 PM, Benoît Minisini wrote:
No you are right. And IPV6 too is not really supported.It's not a domain I know well. So I don't know at the moment if it's just a matter of adding an option to the 'Socket' class to let it open the socket in raw mode, or if a new class must be created because the behaviour of a raw socket is too much different.
I don't know this particular domain well either, but I've been looking into it. I found a couple of examples of how it can be done in Python, and it looks to be simply using a raw socket. https://denizhalil.com/2024/04/06/sending-icmp-packets-with-python-socket-adventure-in-signaling/ : ~~~~~~ with socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP) as sock: # Set socket TTL sock.setsockopt(socket.IPPROTO_IP, socket.IP_TTL, struct.pack("I", self.ttl)) ~~~~~~ https://inc0x0.com/icmp-ip-packets-ping-manually-create-and-send-icmp-ip-packets/ : ~~~~~~ s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP) s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) ~~~~~~ Why this one uses the IPPROTO_TCP protocol I have no clue. I see that the example Olivier posted uses 'sendto'. For reference: https://www.man7.org/linux//man-pages/man2/send.2.html https://www.man7.org/linux//man-pages/man2/socket.2.html -- Lee --- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ---- --- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----
ICMP socket with Gambas | Linus <olivier.cruilles@xxxxxxxx> |
Re: ICMP socket with Gambas | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |