[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ICMP socket with Gambas - working


On 6/30/25 9:18 AM, Lee wrote:
So, it is indeed possible to short-circuit the embedded in_addr structure as I originally supposed?

To answer my own question just in case it might help, Olivier, yes it is possible to replace the embedded in_addr structure member in socketaddr_in with an integer.

Structure:
Public Struct SockAddr_in
  SinFamily As Short
  SinPort As Short
  SinAddr As Integer
  _pad[8] As Byte ' Be sure to include the padding
End Struct

Code to stuff the address with `inet_pton`:
  DestAddr.SinFamily = AF_INET
  DestAddr.SinPort = 0
  rc = inet_pton(AF_INET, "8.8.8.8", VarPtr(iSinAddr)) ' Use a substitute var as VarPtr(DestAddr.SinAddr) will not work.
  If rc < 1 Then
    Print "Error converting address."
    Quit
  Endif
  DestAddr.SinAddr = iSinAddr


I hope you are able to effectively sort out this thread and implement a solution that works for you. :-)

And, thank you for the "Socket_Linux_documentation" PDF. I have saved it for future reference.


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


References:
Re: ICMP socket with GambasLee <t.lee.davidson@xxxxxxxxx>
Re: ICMP socket with GambasLinus <olivier.cruilles@xxxxxxxx>
Re: ICMP socket with GambasLee <t.lee.davidson@xxxxxxxxx>
Re: ICMP socket with Gambasvuott@xxxxxxxxxxxx
Re: ICMP socket with GambasLee <t.lee.davidson@xxxxxxxxx>
Re: ICMP socket with Gambasvuott@xxxxxxxxxxxx
Re: ICMP socket with Gambas - workingLee <t.lee.davidson@xxxxxxxxx>
Re: ICMP socket with Gambas - workingBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: ICMP socket with Gambas - workingLee <t.lee.davidson@xxxxxxxxx>