librnr/sock.c
void SocketAttrSetRemoteName(Socket_T        *pSocket,
                             struct sockaddr *pAddr,
                             const char      *sHostName)
{
  CHKPTR(pSocket);

  delete(pSocket->m_sRemoteName);

  // closed
  if( !SocketStateIsOpen(pSocket) )
  {
    pSocket->m_sRemoteName = new_strdup(SockStrDisconnected);
  }

  // set preferred address named
  else if( pAddr != NULL )
  {
    pSocket->m_sRemoteName = SocketAddrName(pAddr, sHostName);
  }

  // simply use host name
  else if( sHostName != NULL )
  {
    pSocket->m_sRemoteName = new_strdup(sHostName);
  }

  // error
  else
  {
    pSocket->m_sRemoteName = new_strdup(SockStrDisconnected);
  }
}
/*!
 * \brief Set Socket remote name.
 *
 * \param pSocket     Pointer to Socket.
 * \param pAddr       Socket address.
 * \param sHostName   Remote host name string.
 */
\brief Set Socket remote name.
\param pSocket     Pointer to Socket.
\param pAddr       Socket address.
\param sHostName   Remote host name string.
\ brief Set Socket remote name . \ param pSocket Pointer to Socket . \ param pAddr Socket address . \ param sHostName Remote host name string .
void SocketAttrSetRemoteName(Socket_T        *pSocket,
                             struct sockaddr *pAddr,
                             const char      *sHostName)
{
  CHKPTR(pSocket);
  delete(pSocket->m_sRemoteName);
  if( !SocketStateIsOpen(pSocket) )
  {
    pSocket->m_sRemoteName = new_strdup(SockStrDisconnected);
  }
  else if( pAddr != NULL )
  {
    pSocket->m_sRemoteName = SocketAddrName(pAddr, sHostName);
  }
  else if( sHostName != NULL )
  {
    pSocket->m_sRemoteName = new_strdup(sHostName);
  }
  else
  {
    pSocket->m_sRemoteName = new_strdup(SockStrDisconnected);
  }
}
void SocketAttrSetRemoteName ( Socket_T * pSocket , struct sockaddr * pAddr , const char * sHostName ) { CHKPTR ( pSocket ) ; delete ( pSocket -> m_sRemoteName ) ; if ( ! SocketStateIsOpen ( pSocket ) ) { pSocket -> m_sRemoteName = new_strdup ( SockStrDisconnected ) ; } else if ( pAddr != NULL ) { pSocket -> m_sRemoteName = SocketAddrName ( pAddr , sHostName ) ; } else if ( sHostName != NULL ) { pSocket -> m_sRemoteName = new_strdup ( sHostName ) ; } else { pSocket -> m_sRemoteName = new_strdup ( SockStrDisconnected ) ; } }
\brief Set Socket remote name.
\ brief Set Socket remote name .
// closed // set preferred address named // simply use host name // error