Provides an implementation for a sender-receiver channel that uses the TCP protocol to transmit messages.
For a list of all members of this type, see TcpChannel Members.
[Visual Basic] Public Class TcpChannel Implements IChannelReceiver, IChannel, IChannelSender [C#] public class TcpChannel : IChannelReceiver, IChannel, IChannelSender [C++] public __gc class TcpChannel : public IChannelReceiver, IChannel, IChannelSender [JScript] public class TcpChannel implements IChannelReceiver, IChannel, IChannelSender
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
The TcpChannel class is a combined channel, which combines the TcpServerChannel and TcpClientChannel for convenience. The TcpChannel uses a binary formatter to serialize all outbound messages to a binary stream and transports the stream to the target URI using the TCP protocol. For inbound messages the process is reversed.
Channels transport messages between applications across remoting boundaries (for example application domains, processes, and machines). These crossings include both inbound and outbound. The current channel listens on an endpoint for inbound messages and sends the outbound messages to the endpoint. TcpChannel converts the messages sent along it to and from the binary format, receiving and sending them using the TCP protocol.
On the client side, messages are handed off to the client channel sink chain after they traverse the client Context chain. The first channel sink is typically an IClientFormatterSink which serializes the message into a stream that is passed down the channel sink chain to the client transport sink. The client transport sink then writes this stream out to the wire.
On the server side, the server transport sink reads requests off of the wire and passes the request stream to the server channel sink chain. The server formatter sink at the end of this chain will deserialize the request into a message. It will then hand this message off to the Remoting infrastructure which will dispatch it to the server Context chain.
IChannel implementations use channel configuration properties to configure the channel at run time. Channel properties can be specified in a configuration file, or programmatically, inside of an IDictionary. In a configuration file all values are represented by strings, but when building a property IDictionary programmatically, value types can be specified with their native values or with strings.
The following table shows the channel configuration properties that can be specified for the current channel.
|name||Indicates the name of the channel. This property is used to retrieve a specific channel when calling GetChannel. If this property is not set, the system defaults to "tcp". If you want to register more than one TcpChannel, each must have a unique name. Set this property to the Empty string ("") if you want to ignore names, but avoid naming collisions. The system will allow any number of channels with the String.Empty name.|
|priority||An integer representing the priority assigned to this channel. Higher numbers indicate a higher chance of being chosen to connect first. The default priority is 1, and negative numbers are allowed.|
|port||An integer specifying the port on which the channel will listen. To request that the remoting system choose an open port on your behalf, specify port "0" (zero). This will create a TcpServerChannel instance to listen for requests on the dyamically assigned port. This is typically done on the client to make sure that a TcpServerChannel is listening for callback methods.|
|supressChannelData||true or false. Specifies that the channel will not contribute to the ChannelData.|
|useIpAddress||true or false. Specifies whether the channel whall use the IP address in the publication URL instead of the computer name.|
|rejectRemoteRequests||true or false. Specifies whether to refuse requests originating from other computers. Specifying true allows only inter-application-domain calls from the local computer.|
|bindTo||An IP address resolving to the current computer that specifies which NIC to bind the current channel to.|
|machineName||A string that specifies the machine name used with the current channel. Overrides the useIpAddress configuration property and the machine name channel data.|
|exclusiveAddressUse||true or false. Specifies whether the server channel will prevent other applications from reusing the IP address/port combination by setting the SocketOptionName server socket option to SocketOptionName.ExclusiveAddressUse. The default is true.
This property is supported only by the .NET Framework version 1.1 on the following platforms: Windows NT 4.0 with SP4 or later, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family.
This property requires administrator privileges on platforms prior to the Windows Server 2003 family.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Runtime.Remoting (in System.Runtime.Remoting.dll)