home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.protocols.tcp-ip      TCP and IP network protocols.      14,669 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 12,838 of 14,669   
   Jorgen Grahn to SpreadTooThin   
   Re: gethost by name and or address?   
   06 May 09 14:58:12   
   
   6b4e90c9   
   From: grahn+nntp@snipabacken.se   
      
   On Tue, 5 May 2009 17:59:43 -0700 (PDT), SpreadTooThin    
   wrote:   
   > If I have a function that sends a message to a host name or IP   
   > address,   
   >   
   > void SendMessageTo(char *hostNameOrIPAddress, int port, char *msg, int   
   > msgSize);   
      
   Better make those strings const: "const char * hostNameOr" and so on.   
      
   > Should I try to determine if the hostNameOrIPAddress is a host name or   
   > IP Address...   
   > gethostbyname or gethostbyaddress.   
   >   
   > Or is one function call good for both?   
   ...   
      
   Maybe you should use getaddrinfo(3)?  It tries to be complete (with   
   name resolution, IPv6 support, support for host names mapping to many   
   addresses ...) and yet easy to use.   
      
   /Jorgen   
      
   --   
     // Jorgen Grahn           R'lyeh wgah'nagl fhtagn!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca