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

BOOL PSTUNClient::SetServer ( const PString server )

Set the STUN server to use. The server string may be of the form host:port. If :port is absent then the default port 3478 is used. The substring port can also be a service name as found in /etc/services. The host substring may be a DNS name or explicit IP address.

Definition at line 154 of file pstun.cxx.

References PString::Find(), PIPSocket::GetHostAddress(), PSocket::GetPortByService(), PIPSocket::Address::IsValid(), PString::Left(), and PString::Mid().

  PINDEX colon = server.Find(':');
  if (colon == P_MAX_INDEX) {
    if (!PIPSocket::GetHostAddress(server, serverAddress))
      return FALSE;
  else {
    if (!PIPSocket::GetHostAddress(server.Left(colon), serverAddress))
      return FALSE;
    serverPort = PIPSocket::GetPortByService("udp", server.Mid(colon+1));

  return serverAddress.IsValid() && serverPort != 0;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index