/// <summary>Unregister this program with the local portmapper.</summary> public virtual void Unregister(int transport, int boundPort) { if (boundPort != port) { Log.Info("The bound port is " + boundPort + ", different with configured port " + port); port = boundPort; } // Unregister all the program versions with portmapper for a given transport for (int vers = lowProgVersion; vers <= highProgVersion; vers++) { PortmapMapping mapEntry = new PortmapMapping(progNumber, vers, transport, port); Register(mapEntry, false); } }
/// <summary>Register the program with Portmap or Rpcbind</summary> protected internal virtual void Register(PortmapMapping mapEntry, bool set) { XDR mappingRequest = PortmapRequest.Create(mapEntry, set); SimpleUdpClient registrationClient = new SimpleUdpClient(host, RpcbPort, mappingRequest , registrationSocket); try { registrationClient.Run(); } catch (IOException e) { string request = set ? "Registration" : "Unregistration"; Log.Error(request + " failure with " + host + ":" + port + ", portmap entry: " + mapEntry); throw new RuntimeException(request + " failure", e); } }