示例#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>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);
 }
        /// <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);
        }
        /// <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);
        }
        /// <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);
        }