Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PIPSocket::GetNetworkInterface ( PIPSocket::Address addr  )  [static, inherited]

Get the address of an interface that corresponds to a real network

Returns:
FALSE if only loopback interfaces could be found, else TRUE

Definition at line 2642 of file sockets.cxx.

{
  PIPSocket::InterfaceTable interfaceTable;
  if (PIPSocket::GetInterfaceTable(interfaceTable)) {
    PINDEX i;
    for (i = 0; i < interfaceTable.GetSize(); ++i) {
      PIPSocket::Address localAddr = interfaceTable[i].GetAddress();
      if (!localAddr.IsLoopback() && (!localAddr.IsRFC1918() || !addr.IsRFC1918()))
        addr = localAddr;
    }
  }
  return addr.IsValid();
}


Generated by  Doxygen 1.6.0   Back to index