Name

TcpClient

Synopsis

This class provides a client-side abstraction of the sockets API. The zero-argument form of the constructor creates the client. Connect to a remote server with the Connect() method (you must specify an existing System.Net.IPEndPoint or a remote IP address and port number). Alternatively, use an overloaded form of the constructor to simultaneously create the client and make the connection.

This class completely obscures the underlying socket. However, the GetStream() method returns a NetworkStream that you can use to send and receive data across the network.

Public Class TcpClient : Implements IDisposable
' Public Constructors
   Public Sub New() 
   Public Sub New( ByVal localEP As System.Net.IPEndPoint) 
   Public Sub New(ByVal hostname As String, 
        ByVal port As Integer) 
' Public Instance Properties
   Public Property LingerState As LingerOption  
   Public Property NoDelay As Boolean  
   Public Property ReceiveBufferSize As Integer  
   Public Property ReceiveTimeout As Integer  
   Public Property SendBufferSize As Integer  
   Public Property SendTimeout As Integer  
' Protected Instance Properties
   Protected Property Active As Boolean  
   Protected Property Client As Socket  
' Public Instance Methods
   Public Sub Close() 
   Public Sub Connect(ByVal address As System.Net.IPAddress, 
        ByVal port As Integer) 
   Public Sub Connect(ByVal remoteEP As System.Net.IPEndPoint) 
   Public Sub Connect(ByVal hostname As String, 
        ByVal port As Integer) 
   Public Function GetStream() As NetworkStream  
' Protected Instance Methods ...

Get VB.NET Core Classes in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.