Re: Tcp Socket Close Event
From: Brian Henry (brian.henry[nospam)
Date: 04/04/04
- Next message: Deano: "Re: how to get from an MS Access app to vb.net?"
- Previous message: Rob Oldfield: "Re: Favorites data"
- In reply to: Haim: "Tcp Socket Close Event"
- Next in thread: Peter Huang: "RE: Tcp Socket Close Event"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 4 Apr 2004 14:53:36 -0400
Isn't this what you are trying to do?
TcpClient.Close Method [Visual Basic]See Also
TcpClient Class | TcpClient Members | System.Net.Sockets Namespace | Close |
Shutdown | TcpClient Members (Visual J# Syntax) | Managed Extensions for C++
Programming Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
family, .NET Compact FrameworkLanguage
C#
C++
JScript
Visual Basic
Show All
Closes the TCP connection and releases all resources associated with the
TcpClient.
[Visual Basic]
Public Sub Close()
[C#]
public void Close();
[C++]
public: void Close();
[JScript]
public function Close();
Exceptions
Exception TypeCondition
SocketExceptionAn error occurred when accessing the socket. See the Remarks
section for more information.
Remarks
The Close method closes the TCP connection. It calls the Dispose method
passing a true value to release all managed and unmanaged resources
associated with the TcpClient. These resources include the underlying Socket
used for connecting with the remote host, and the NetworkStream used to send
and receive data.
Note If you receive a SocketException, use SocketException.ErrorCode to
obtain the specific error code. Once you have obtained this code, you can
refer to the Windows Socket Version 2 API error code documentation in MSDN
for a detailed description of the error.
Example
[Visual Basic, C#, C++] The following example demonstrates closing a
TcpClient by calling the Close method.
[Visual Basic]
Dim tcpClientD As New TcpClient(AddressFamily.InterNetwork)
' Uses the Close public method to close the network stream and socket.
tcpClient.Close()
End Sub 'MyTcpClientCommunicator
"Haim" <haim@spetrotec.com> wrote in message
news:%23YJ3uAjGEHA.264@TK2MSFTNGP12.phx.gbl...
> it is very strange for me that a simple event of closing socket that was
in
> the the winsock object of vb6 ,
>
> i didn't found yet in the vb.net
>
> the only way i found is to try to send something to the socket and if i
got
> error then the socket is closed.
>
> there must be a way to get this event without trying to send something ,
> since it is in the lower level
>
> can you advice please,
>
> thanks in advance,
>
> Haim.
>
>
- Next message: Deano: "Re: how to get from an MS Access app to vb.net?"
- Previous message: Rob Oldfield: "Re: Favorites data"
- In reply to: Haim: "Tcp Socket Close Event"
- Next in thread: Peter Huang: "RE: Tcp Socket Close Event"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|