[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ICMP socket with Gambas - working
[Thread Prev] | [Thread Next]
- Subject: Re: ICMP socket with Gambas - working
- From: Linus <olivier.cruilles@xxxxxxxx>
- Date: Mon, 30 Jun 2025 11:41:45 -0400
- To: Lee <t.lee.davidson@xxxxxxxxx>
- Cc: Linus <olivier.cruilles@xxxxxxxx>, Gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>
Hello, Thank you all for your answer. I’m still dealing with that and how I will use those information you gave me. If you are interested, I found this document/thread about UNIX Socket, that I have reformatted into a PDF file.
Attachment:
Socket_Linux_documentation.pdf
Description: Adobe PDF document
Olivier > Le 30 juin 2025 à 09:18, Lee <t.lee.davidson@xxxxxxxxx> a écrit : > > On 6/30/25 4:22 AM, Benoît Minisini wrote: >> It's because you used "Long" for SinAddr, whereas it must be "Integer". "Long" in Gambas is a 64-bit integer. >> Every structure field is aligned to a memory address that is a multiple of the field size, but as the fields order is kept, some extra padding may be added between misaligned fields. >> Moreover, the structure you must declare is actually "SockAddr_In", not "SockAddr". So: > (Yes, that is correct. I just didn't name it SockAddr_in as I was not aware of SockAddr at the time.) >> Public Struct SockAddr_In >> SinFamily As Short >> SinPort As Short >> SinAddr As Integer >> _Padding[8] As Byte >> End Struct >> Because you have SockAddr_In6 too for IPV6, which is different, but both can be aliased to SockAddr which is declared that way: >> Public Struct SockAddr_In >> SinFamily As Short >> _Padding[14] As Byte >> End Struct > > Thank you for taking the time to try clearing up my confusion, Benoît. > > However, using Long for SinAddr was only my first attempt. I had read https://www.man7.org/linux/man-pages/man3/sockaddr.3type.html and thought I might be able to short-circuit the embedded in_addr structure. On 29 Jun 2025, I reported [1] that I had made changes in the code to use the following structure (which conforms to that man page): > > Public Struct In_addr > s_addr As Integer > End Struct > > Public Struct Sockaddr_in > sin_family As Short > sin_port As Short > sin_addr As Struct In_addr > End Struct > > When I subsequently wrote about extraneous bytes, it was in the context of the above structures. (It's been a relatively busy thread, and I know you've been busy with personal things.) > > I don't find sin_addr anywhere defined as an integer. `echo "#include <netinet/in.h>" | gcc -E -` shows it defined as a struct in_addr. So, it is indeed possible to short-circuit the embedded in_addr structure as I originally supposed? > > > [1] https://lists.gambas-basic.org/archive/user/2025-06/0000073.html > > > -- > Lee > > --- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ---- > --- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ---- > >
Re: ICMP socket with Gambas | Lee <t.lee.davidson@xxxxxxxxx> |
Re: ICMP socket with Gambas | Linus <olivier.cruilles@xxxxxxxx> |
Re: ICMP socket with Gambas | Lee <t.lee.davidson@xxxxxxxxx> |
Re: ICMP socket with Gambas | vuott@xxxxxxxxxxxx |
Re: ICMP socket with Gambas | Lee <t.lee.davidson@xxxxxxxxx> |
Re: ICMP socket with Gambas | vuott@xxxxxxxxxxxx |
Re: ICMP socket with Gambas - working | Lee <t.lee.davidson@xxxxxxxxx> |
Re: ICMP socket with Gambas - working | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: ICMP socket with Gambas - working | Lee <t.lee.davidson@xxxxxxxxx> |