| Visual Basic (Declaration) | |
|---|---|
Public Function New( _ ByVal acceptedSocket As Socket _ ) | |
| C# | |
|---|---|
public Tcp( Socket acceptedSocket ) | |
| Managed Extensions for C++ | |
|---|---|
public: Tcp( Socket* acceptedSocket ) | |
| C++/CLI | |
|---|---|
public: Tcp( Socket^ acceptedSocket ) | |
Parameters
- acceptedSocket
- The System.Net.Sockets.Socket to use for the underlying connection.
The following example demonstrates creating a Tcp object.
| Visual Basic | Copy Code |
|---|---|
' Declare as class member Friend WithEvents Tcp1 As Tcp ' Create in class initialization Me.Tcp1 = New Tcp() | |
| C# | Copy Code |
|---|---|
private Tcp tcp1 = new Tcp(); | |
Use this constructor create an instance of the Tcp class using an already created Socket. Typically, this is used when a connection is made on a socket that is listening for connections.
To create an instance of the Tcp component using Visual Studio.NET, simply add the Tcp component to the form and the object will automatically be created and initialized. If working out of the Visual Studio.NET environment (or using the Tcp component as a reference), the Tcp component will have to be explicitly created and initialized.
The following table shows initial property values for an instance of Tcp.
| Property | Initial Value |
|---|---|
| Tcp.Available | 0 |
| Tcp.Charset | Default system charset (accessible via System.Text.Encoding.Default.BodyName) |
| Tcp.Connected | false |
| Tcp.DoEvents | true |
| Tcp.KeepAlive | false |
| Tcp.LocalEndPoint | reference to System.Net.IPEndPoint |
| Tcp.NoDelay | false |
| Tcp.OutOfBandInline | false |
| Tcp.Proxy | reference to Dart.PowerTCP.Proxy |
| Tcp.ReceiveBufferSize | 8192 |
| Tcp.ReceiveTimeout | 0 |
| Tcp.RemoteEndPoint | reference to System.Net.IPEndPoint |
| Tcp.ReuseAddress | false |
| Tcp.SendBufferSize | 8192 |
| Tcp.SendTimeout | 0 |
| Tcp.Socket | null |
| Tcp.State | null |
| Tcp.Stream | SegmentedStream object |
Target Platforms: Microsoft .NET Framework 2.0