Exemplo n.º 1
0
 /// <summary>
 /// Removes a TCP/IP server transport from the list of currently open
 /// transports.
 /// </summary>
 /// <remarks>
 /// Removes a TCP/IP server transport from the list of currently open
 /// transports.
 /// </remarks>
 /// <param name="transport">
 /// Server transport to remove from the list of currently
 /// open transports for this listening transport.
 /// </param>
 public virtual void removeTransport(org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport
                                     transport)
 {
     lock (openTransports)
     {
         openTransports.remove((object)transport);
     }
 }
Exemplo n.º 2
0
 /// <summary>Close the server transport and free any resources associated with it.</summary>
 /// <remarks>
 /// Close the server transport and free any resources associated with it.
 /// <p>Note that the server transport is <b>not deregistered</b>. You'll
 /// have to do it manually if you need to do so. The reason for this
 /// behaviour is, that the portmapper removes all entries regardless of
 /// the protocol (TCP/IP or UDP/IP) for a given ONC/RPC program number
 /// and version.
 /// <p>Calling this method on a <code>OncRpcTcpServerTransport</code>
 /// results in the listening TCP network socket immediately being closed.
 /// In addition, all server transports handling the individual TCP/IP
 /// connections will also be closed. The handler threads will therefore
 /// either terminate directly or when they try to sent back replies.
 /// </remarks>
 public override void Close()
 {
     if (socket != null)
     {
         //
         // Since there is a non-zero chance of getting race conditions,
         // we now first set the socket instance member to null, before
         // we close the corresponding socket. This avoids null-pointer
         // exceptions in the method which waits for connections: it is
         // possible that that method is awakened because the socket has
         // been closed before we could set the socket instance member to
         // null. Many thanks to Michael Smith for tracking down this one.
         //
         Socket deadSocket = socket;
         socket = null;
         try
         {
             deadSocket.Close();
         }
         catch (Exception e)
         {
             Console.Out.WriteLine(e.Message);
             Console.Out.WriteLine(e.StackTrace);
         }
     }
     //
     // Now close all per-connection transports currently open...
     //
     lock (openTransports)
     {
         while (openTransports.size() > 0)
         {
             org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport transport = (org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport
                                                                                     )openTransports.removeFirst();
             transport.Close();
         }
     }
 }