PeerCastStation.UI.HTTP.APIHost.APIContext.AddListener C# (CSharp) Method

AddListener() private method

private AddListener ( string address, int port, int localAccepts, int globalAccepts, bool localAuthorizationRequired = false, bool globalAuthorizationRequired = true ) : Newtonsoft.Json.Linq.JObject
address string
port int
localAccepts int
globalAccepts int
localAuthorizationRequired bool
globalAuthorizationRequired bool
return Newtonsoft.Json.Linq.JObject
      private JObject AddListener(
          string address,
          int port,
          int localAccepts,
          int globalAccepts,
          bool localAuthorizationRequired=false,
          bool globalAuthorizationRequired=true)
      {
        IPAddress addr;
        OutputListener listener;
        IPEndPoint endpoint;
        if (address==null) {
          endpoint = new IPEndPoint(IPAddress.Any, port);
        }
        else if (IPAddress.TryParse(address, out addr)) {
          endpoint = new IPEndPoint(addr, port);
        }
        else {
          throw new RPCError(RPCErrorCode.InvalidParams, "Invalid ip address");
        }
        listener = PeerCast.StartListen(endpoint, (OutputStreamType)localAccepts, (OutputStreamType)globalAccepts);
        listener.LocalAuthorizationRequired  = localAuthorizationRequired;
        listener.GlobalAuthorizationRequired = globalAuthorizationRequired;
        owner.Application.SaveSettings();
        return GetListener(listener);
      }