library: libCore #include "TInetAddress.h"

# TInetAddress

class description - source file - inheritance tree (.pdf)

## class TInetAddress : public TObject

| Inheritance Chart:
`TObject`
| <- | `TInetAddress` |

        private:

                       TInetAddress(const char* host, UInt_t addr, Int_t family, Int_t port = -1)
                  void AddAddress(UInt_t addr)
                  void AddAlias(const char* alias)

        public:

                                             TInetAddress()
                                             TInetAddress(const TInetAddress& adr)
                                     virtual ~TInetAddress()
                              static TClass* Class()
                                      UInt_t GetAddress() const
                                    UChar_t* GetAddressBytes() const
          const TInetAddress::AddressList_t& GetAddresses() const
            const TInetAddress::AliasList_t& GetAliases() const
                                       Int_t GetFamily() const
                                 const char* GetHostAddress() const
                          static const char* GetHostAddress(UInt_t addr) const
                                 const char* GetHostName() const
                                       Int_t GetPort() const
                             virtual TClass* IsA() const
                                      Bool_t IsValid() const
                               TInetAddress& operator=(const TInetAddress& rhs)
                                virtual void Print(Option_t* option = "") const
                                virtual void ShowMembers(TMemberInspector& insp, char* parent)
                                virtual void Streamer(TBuffer& b)
                                        void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

                                                TString fHostname   fully qualified hostname
                                                 UInt_t fAddress    IP address in host byte order
                                                  Int_t fFamily     address family
                                                  Int_t fPort       port through which we are connected
          vector<unsigned int,allocator<unsigned int> > fAddresses  list of all IP addresses in host byte order
                    vector<TString,allocator<TString> > fAliases    list of aliases

## Class Description

     TInetAddress

     This class represents an Internet Protocol (IP) address.

TInetAddress()

     Default ctor. Used in case of unknown host. Not a valid address.

TInetAddress(const char *host, UInt_t addr, Int_t family, Int_t port)

     Create TInetAddress. Private ctor. TInetAddress objects can only
     be created via the friend classes TSystem, TServerSocket and TSocket.
     Use the IsValid() method to check the validity of a TInetAddress.

TInetAddress(const TInetAddress &adr) : TObject(adr)

     TInetAddress copy ctor.

UChar_t* GetAddressBytes() const

     Returns the raw IP address in host byte order. The highest
     order byte position is in addr[0]. To be prepared for 64-bit
     IP addresses an array of bytes is returned.
     User must delete allocated memory.

const char* GetHostAddress(UInt_t addr)

     Returns the IP address string "%d.%d.%d.%d", use it to convert
     alternative addresses obtained via GetAddresses().
     Copy string immediately, it will be reused. Static function.

const char* GetHostAddress() const

     Returns the IP address string "%d.%d.%d.%d".
     Copy string immediately, it will be reused.

void Print(Option_t *) const

     Print internet address as string.

void AddAddress(UInt_t addr)

     Add alternative address to list of addresses.

void AddAlias(const char *alias)

     Add alias to list of aliases.

void Streamer(TBuffer &R__b)

     Stream an object of class TInetAddress.

### Inline Functions

                                          void ~TInetAddress()
                                 TInetAddress& operator=(const TInetAddress& rhs)
                                        UInt_t GetAddress() const
                                   const char* GetHostName() const
                                         Int_t GetFamily() const
                                         Int_t GetPort() const
            const TInetAddress::AddressList_t& GetAddresses() const
              const TInetAddress::AliasList_t& GetAliases() const
                                        Bool_t IsValid() const
                                       TClass* Class()
                                       TClass* IsA() const
                                          void ShowMembers(TMemberInspector& insp, char* parent)
                                          void StreamerNVirtual(TBuffer& b)

Author: Fons Rademakers 16/12/96
Last update: root/net:$Name: $:$Id: TInetAddress.cxx,v 1.8 2005/06/23 00:29:37 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *