添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
高大的脸盆  ·  Element: ...·  4 月前    · 
酒量大的芹菜  ·  PyQt5 QImage from ...·  1 年前    · 

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge
public:
 void Shutdown(System::Net::Sockets::SocketShutdown how);
public void Shutdown (System.Net.Sockets.SocketShutdown how);
member this.Shutdown : System.Net.Sockets.SocketShutdown -> unit
Public Sub Shutdown (how As SocketShutdown)

Parameters

Console::WriteLine( "Winsock error: {0}", Convert::ToString( System::Runtime::InteropServices::Marshal::GetLastWin32Error() ) ); aSocket.Shutdown(SocketShutdown.Both); finally aSocket.Close(); aSocket.Shutdown(SocketShutdown.Both) Finally aSocket.Close() End Try End Sub

Remarks

When using a connection-oriented Socket , always call the Shutdown method before closing the Socket . This ensures that all data is sent and received on the connected socket before it is closed.

Call the Close method to free all managed and unmanaged resources associated with the Socket . Do not attempt to reuse the Socket after closing.

The following table shows the SocketShutdown enumeration values that are valid for the how parameter.

Value Description

Setting how to Send specifies that subsequent calls to Send are not allowed. If you are using a connectionless Socket , specifying Send will have no effect.

Setting how to Receive specifies that subsequent calls to Receive are not allowed. This has no effect on lower protocol layers. If you are using a connection-oriented protocol, the connection is terminated if either of the following conditions exist after a call to Shutdown :

  • Data is in the incoming network buffer waiting to be received.

  • More data has arrived.

    If you are using a connectionless protocol, datagrams are accepted and queued. However, if no buffer space is available for additional incoming datagrams, they will be discarded and no error will be returned to the sender. Using Shutdown on a connectionless Socket is not recommended.

    Setting how to Both disables both sends and receives as described above.

    If you receive a SocketException when calling the Shutdown method, use the SocketException.ErrorCode property to obtain the specific error code. After you have obtained this code, refer to the Windows Sockets version 2 API error code documentation for a detailed description of the error.

    This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in .NET Framework .

  •