コード例 #1
0
        /// <summary>
        /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
        /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server.
        /// </summary>
        /// <remarks>
        /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
        /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server. This
        /// particular server transport only waits for incoming connection requests
        /// and then creates
        /// <see cref="OncRpcTcpConnectionServerTransport">OncRpcTcpConnectionServerTransport
        ///     </see>
        /// server transports
        /// to handle individual connections.
        /// </remarks>
        /// <param name="dispatcher">
        /// Reference to interface of an object capable of
        /// dispatching (handling) ONC/RPC calls.
        /// </param>
        /// <param name="bindAddr">The local Internet Address the server will bind to.</param>
        /// <param name="port">
        /// Number of port where the server will wait for incoming
        /// calls.
        /// </param>
        /// <param name="info">
        /// Array of program and version number tuples of the ONC/RPC
        /// programs and versions handled by this transport.
        /// </param>
        /// <param name="bufferSize">
        /// Size of buffer used when receiving and sending
        /// chunks of XDR fragments over TCP/IP. The fragments built up to
        /// form ONC/RPC call and reply messages.
        /// </param>
        /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        public OncRpcTcpServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
                                        , IPAddress bindAddr, int port, org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo
                                        [] info, int bufferSize) : base(dispatcher, port, info)
        {
            openTransports = new org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList
                                 (this);
            //
            // Make sure the buffer is large enough and resize system buffers
            // accordingly, if possible.
            //
            if (bufferSize < 1024)
            {
                bufferSize = 1024;
            }
            this.bufferSize = bufferSize;
            socket          = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            if (bindAddr == null)
            {
                bindAddr = IPAddress.Any;
            }
            IPEndPoint localEP = new IPEndPoint(bindAddr, port);

            socket.Bind(localEP);
            if (port == 0)
            {
                this.port = ((IPEndPoint)socket.LocalEndPoint).Port;
            }
            socket.Listen(0);
        }
コード例 #2
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
 /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
 /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server. This
 /// particular server transport only waits for incoming connection requests
 /// and then creates
 /// <see cref="OncRpcTcpConnectionServerTransport">OncRpcTcpConnectionServerTransport
 ///     </see>
 /// server transports
 /// to handle individual connections.
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="port">
 /// Number of port where the server will wait for incoming
 /// calls.
 /// </param>
 /// <param name="info">
 /// Array of program and version number tuples of the ONC/RPC
 /// programs and versions handled by this transport.
 /// </param>
 /// <param name="bufferSize">
 /// Size of buffer used when receiving and sending
 /// chunks of XDR fragments over TCP/IP. The fragments built up to
 /// form ONC/RPC call and reply messages.
 /// </param>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public OncRpcTcpServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
                                 , int port, org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo[] info
                                 , int bufferSize) : this(dispatcher, null, port, info, bufferSize)
 {
     openTransports = new org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList
                          (this);
 }
コード例 #3
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcTcpSConnectionerverTransport</code>
 /// which encapsulates TCP/IP-based XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcTcpSConnectionerverTransport</code>
 /// which encapsulates TCP/IP-based XDR streams of an ONC/RPC server. This
 /// particular server transport handles individual ONC/RPC connections over
 /// TCP/IP. This constructor is a convenience constructor for those transports
 /// handling only a single ONC/RPC program and version number.
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="socket">TCP/IP-based socket of new connection.</param>
 /// <param name="program">
 /// Number of ONC/RPC program handled by this server
 /// transport.
 /// </param>
 /// <param name="version">Version number of ONC/RPC program handled.</param>
 /// <param name="bufferSize">
 /// Size of buffer used when receiving and sending
 /// chunks of XDR fragments over TCP/IP. The fragments built up to
 /// form ONC/RPC call and reply messages.
 /// </param>
 /// <param name="parent">Parent server transport which created us.</param>
 /// <param name="transmissionTimeout">Inherited transmission timeout.</param>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public OncRpcTcpConnectionServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable
                                           dispatcher, Socket socket, int program, int version, int bufferSize, org.acplt.oncrpc.server.OncRpcTcpServerTransport
                                           parent, int transmissionTimeout) : this(dispatcher, socket, new org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo
                                                                                   [] { new org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo(program,
                                                                                                                                                          version) }, bufferSize, parent, transmissionTimeout)
 {
 }
コード例 #4
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
 /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcTcpServerTransport</code> which
 /// encapsulates TCP/IP-based XDR streams of an ONC/RPC server. This
 /// particular server transport only waits for incoming connection requests
 /// and then creates
 /// <see cref="OncRpcTcpConnectionServerTransport">OncRpcTcpConnectionServerTransport
 ///     </see>
 /// server transports
 /// to handle individual connections.
 /// This constructor is a convenience constructor for those transports
 /// handling only a single ONC/RPC program and version number.
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="port">
 /// Number of port where the server will wait for incoming
 /// calls.
 /// </param>
 /// <param name="program">
 /// Number of ONC/RPC program handled by this server
 /// transport.
 /// </param>
 /// <param name="version">Version number of ONC/RPC program handled.</param>
 /// <param name="bufferSize">
 /// Size of buffer used when receiving and sending
 /// chunks of XDR fragments over TCP/IP. The fragments built up to
 /// form ONC/RPC call and reply messages.
 /// </param>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public OncRpcTcpServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
                                 , int port, int program, int version, int bufferSize) : this(dispatcher, port, new
                                                                                              org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo[] { new org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo
                                                                                                                                                                    (program, version) }, bufferSize)
 {
     openTransports = new org.acplt.oncrpc.server.OncRpcTcpServerTransport.TransportList
                          (this);
 }
コード例 #5
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcServerTransport</code> which
 /// encapsulates XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcServerTransport</code> which
 /// encapsulates XDR streams of an ONC/RPC server. Using a server transport,
 /// ONC/RPC calls are received and the corresponding replies are sent back.
 /// <p>We do not create any XDR streams here, as it is the responsibility
 /// of derived classes to create appropriate XDR stream objects for the
 /// respective kind of transport mechanism used (like TCP/IP and UDP/IP).
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="port">
 /// Number of port where the server will wait for incoming
 /// calls.
 /// </param>
 /// <param name="info">
 /// Array of program and version number tuples of the ONC/RPC
 /// programs and versions handled by this transport.
 /// </param>
 internal OncRpcServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
                                , int port, org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo[] info
                                )
 {
     this.dispatcher = dispatcher;
     this.port       = port;
     this.info       = info;
 }
コード例 #6
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcTcpSConnectionerverTransport</code>
 /// which encapsulates TCP/IP-based XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcTcpSConnectionerverTransport</code>
 /// which encapsulates TCP/IP-based XDR streams of an ONC/RPC server. This
 /// particular server transport handles individual ONC/RPC connections over
 /// TCP/IP.
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="socket">TCP/IP-based socket of new connection.</param>
 /// <param name="info">
 /// Array of program and version number tuples of the ONC/RPC
 /// programs and versions handled by this transport.
 /// </param>
 /// <param name="bufferSize">
 /// Size of buffer used when receiving and sending
 /// chunks of XDR fragments over TCP/IP. The fragments built up to
 /// form ONC/RPC call and reply messages.
 /// </param>
 /// <param name="parent">Parent server transport which created us.</param>
 /// <param name="transmissionTimeout">Inherited transmission timeout.</param>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public OncRpcTcpConnectionServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable
                                           dispatcher, Socket socket, org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo
                                           [] info, int bufferSize, org.acplt.oncrpc.server.OncRpcTcpServerTransport parent
                                           , int transmissionTimeout) : base(dispatcher, 0, info)
 {
     this.parent = parent;
     this.transmissionTimeout = transmissionTimeout;
     //
     // Make sure the buffer is large enough and resize system buffers
     // accordingly, if possible.
     //
     if (bufferSize < 1024)
     {
         bufferSize = 1024;
     }
     this.socket = socket;
     this.port   = ((IPEndPoint)socket.RemoteEndPoint).Port;
     if (socket.SendBufferSize < bufferSize)
     {
         socket.SendBufferSize = bufferSize;
     }
     if (socket.ReceiveBufferSize < bufferSize)
     {
         socket.ReceiveBufferSize = bufferSize;
     }
     //
     // Create the necessary encoding and decoding streams, so we can
     // communicate at all.
     //
     sendingXdr   = new org.acplt.oncrpc.XdrTcpEncodingStream(socket, bufferSize);
     receivingXdr = new org.acplt.oncrpc.XdrTcpDecodingStream(socket, bufferSize);
     //
     // Inherit the character encoding setting from the listening
     // transport (parent transport).
     //
     setCharacterEncoding(parent.getCharacterEncoding());
 }
コード例 #7
0
        /// <summary>
        /// Create a new instance of a <code>OncRpcServerTransport</code> which
        /// encapsulates XDR streams of an ONC/RPC server.
        /// </summary>
        /// <remarks>
        /// Create a new instance of a <code>OncRpcServerTransport</code> which
        /// encapsulates XDR streams of an ONC/RPC server. Using a server transport,
        /// ONC/RPC calls are received and the corresponding replies are sent back.
        /// <p>We do not create any XDR streams here, as it is the responsibility
        /// of derived classes to create appropriate XDR stream objects for the
        /// respective kind of transport mechanism used (like TCP/IP and UDP/IP).
        /// </remarks>
        /// <param name="dispatcher">
        /// Reference to interface of an object capable of
        /// dispatching (handling) ONC/RPC calls.
        /// </param>
        /// <param name="port">
        /// Number of port where the server will wait for incoming
        /// calls.
        /// </param>
        /// <param name="info">
        /// Array of program and version number tuples of the ONC/RPC
        /// programs and versions handled by this transport.
        /// </param>
        internal OncRpcServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
			, int port, org.acplt.oncrpc.server.OncRpcServerTransportRegistrationInfo[] info
			)
        {
            this.dispatcher = dispatcher;
            this.port = port;
            this.info = info;
        }
コード例 #8
0
 /// <summary>
 /// Create a new instance of a <code>OncRpcUdpServerTransport</code> which
 /// encapsulates UDP/IP-based XDR streams of an ONC/RPC server.
 /// </summary>
 /// <remarks>
 /// Create a new instance of a <code>OncRpcUdpServerTransport</code> which
 /// encapsulates UDP/IP-based XDR streams of an ONC/RPC server. Using a
 /// server transport, ONC/RPC calls are received and the corresponding
 /// replies are sent back.
 /// This constructor is a convenience constructor for those transports
 /// handling only a single ONC/RPC program and version number.
 /// </remarks>
 /// <param name="dispatcher">
 /// Reference to interface of an object capable of
 /// dispatching (handling) ONC/RPC calls.
 /// </param>
 /// <param name="port">
 /// Number of port where the server will wait for incoming
 /// calls.
 /// </param>
 /// <param name="info">
 /// Array of program and version number tuples of the ONC/RPC
 /// programs and versions handled by this transport.
 /// </param>
 /// <param name="bufferSize">
 /// Size of buffer for receiving and sending UDP/IP
 /// datagrams containing ONC/RPC call and reply messages.
 /// </param>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 public OncRpcUdpServerTransport(org.acplt.oncrpc.server.OncRpcDispatchable dispatcher
                                 , int port, OncRpcServerTransportRegistrationInfo[] info
                                 , int bufferSize) : this(dispatcher, null, port, info, bufferSize)
 {
 }