[adasockets] Value function does not work..

Ramasivan, Ganesh Ganesh.Ramasivan at gdcanada.com
Fri Aug 6 22:20:06 CEST 2004


Hello everyone,

I am having a problem making use of the Value function from sockets-naming.adb.

The following is the code segment:

   function Value (Add : String) return Address
   is
      function Convert is
         new Ada.Unchecked_Conversion (Source => Interfaces.Unsigned_32,
                                       Target => In_Addr);
      C_Add     : chars_ptr        := New_String (Add);
      Converted : constant In_Addr := Convert (C_Inet_Addr (C_Add));
   begin
      Free (C_Add);
      return (H1 => Address_Component (Converted.S_B1),
              H2 => Address_Component (Converted.S_B2),
              H3 => Address_Component (Converted.S_B3),
              H4 => Address_Component (Converted.S_B4));
   end Value;

I always get a result of 255.255.255.255 as the output of this routine. It looks like C_Inet_Addr returns 0xFFFFFFFF and I don't understand why.

I am running on Solaris 2.8.


More information about the AdaSockets mailing list