Socket.Close Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Closes this socket.
[Android.Runtime.Register("close", "()V", "GetCloseHandler")]
public virtual void Close ();
[<Android.Runtime.Register("close", "()V", "GetCloseHandler")>]
abstract member Close : unit -> unit
override this.Close : unit -> unit
Implements
- Attributes
Exceptions
if an error occurs while closing the socket.
Remarks
Closes this socket.
Any thread currently blocked in an I/O operation upon this socket will throw a SocketException
.
Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created.
Closing this socket will also close the socket's java.io.InputStream InputStream
and java.io.OutputStream OutputStream
.
If this socket has an associated channel then the channel is closed as well.
Java documentation for java.net.Socket.close()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.