本文整理汇总了C#中SocketShutdown.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SocketShutdown.ToString方法的具体用法?C# SocketShutdown.ToString怎么用?C# SocketShutdown.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocketShutdown
的用法示例。
在下文中一共展示了SocketShutdown.ToString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalShutdown
// This version does not throw.
internal void InternalShutdown(SocketShutdown how)
{
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::InternalShutdown() how:" + how.ToString());
if (CleanedUp || _handle.IsInvalid)
{
return;
}
try
{
SocketPal.Shutdown(_handle, _isConnected, _isDisconnected, how);
}
catch (ObjectDisposedException) { }
}
示例2: Shutdown
// Disables sends and receives on a socket.
public void Shutdown(SocketShutdown how)
{
if (s_loggingEnabled)
{
Logging.Enter(Logging.Sockets, this, "Shutdown", how);
}
if (CleanedUp)
{
throw new ObjectDisposedException(this.GetType().FullName);
}
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::Shutdown() how:" + how.ToString());
// This can throw ObjectDisposedException.
SocketError errorCode = SocketPal.Shutdown(_handle, _isConnected, _isDisconnected, how);
GlobalLog.Print("Socket#" + Logging.HashString(this) + "::Shutdown() Interop.Winsock.shutdown returns errorCode:" + errorCode);
// Skip good cases: success, socket already closed.
if (errorCode != SocketError.Success && errorCode != SocketError.NotSocket)
{
// Update the internal state of this socket according to the error before throwing.
SocketException socketException = new SocketException((int)errorCode);
UpdateStatusAfterSocketError(socketException);
if (s_loggingEnabled)
{
Logging.Exception(Logging.Sockets, this, "Shutdown", socketException);
}
throw socketException;
}
SetToDisconnected();
InternalSetBlocking(_willBlockInternal);
if (s_loggingEnabled)
{
Logging.Exit(Logging.Sockets, this, "Shutdown", "");
}
}
示例3: InternalShutdown
// this version does not throw.
internal void InternalShutdown(SocketShutdown how) {
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString());
if (CleanedUp || m_Handle.IsInvalid) {
return;
}
try
{
UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int)how);
}
catch (ObjectDisposedException) { }
}
示例4: Shutdown
/// <devdoc>
/// <para>
/// Disables sends and receives on a socket.
/// </para>
/// </devdoc>
public void Shutdown(SocketShutdown how) {
if(s_LoggingEnabled)Logging.Enter(Logging.Sockets, this, "Shutdown", how);
if (CleanedUp) {
throw new ObjectDisposedException(this.GetType().FullName);
}
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() how:" + how.ToString());
// This can throw ObjectDisposedException.
SocketError errorCode = UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int) how);
//
// if the native call fails we'll throw a SocketException
//
errorCode = errorCode!=SocketError.SocketError ? SocketError.Success : (SocketError)Marshal.GetLastWin32Error();
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() UnsafeNclNativeMethods.OSSOCK.shutdown returns errorCode:" + errorCode);
//
// skip good cases: success, socket already closed
//
if (errorCode!=SocketError.Success && errorCode!=SocketError.NotSocket) {
//
// update our internal state after this socket error and throw
//
SocketException socketException = new SocketException(errorCode);
UpdateStatusAfterSocketError(socketException);
if(s_LoggingEnabled)Logging.Exception(Logging.Sockets, this, "Shutdown", socketException );
throw socketException;
}
SetToDisconnected();
InternalSetBlocking(willBlockInternal);
if(s_LoggingEnabled)Logging.Exit(Logging.Sockets, this, "Shutdown", "");
}
示例5: InternalShutdown
// this version does not throw.
internal void InternalShutdown(SocketShutdown how) {
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::InternalShutdown() how:" + how.ToString());
if (CleanedUp || m_Handle==SocketErrors.InvalidSocketIntPtr) {
return;
}
UnsafeNclNativeMethods.OSSOCK.shutdown(m_Handle, (int)how);
}
示例6: Shutdown
/// <include file='doc\Socket.uex' path='docs/doc[@for="Socket.Shutdown"]/*' />
/// <devdoc>
/// <para>
/// Disables sends and receives on a socket.
/// </para>
/// </devdoc>
public void Shutdown(SocketShutdown how) {
if (CleanedUp) {
throw new ObjectDisposedException(this.GetType().FullName);
}
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Shutdown() how:" + how.ToString());
if (m_Handle==SocketErrors.InvalidSocketIntPtr) {
//
// oh well, we really can't do a lot here
//
return;
}
int errorCode =
UnsafeNclNativeMethods.OSSOCK.shutdown(
m_Handle,
(int)how);
//
// if the native call fails we'll throw a SocketException
//
errorCode = errorCode!=SocketErrors.SocketError ? 0 : Marshal.GetLastWin32Error();
GlobalLog.Print("Socket#" + ValidationHelper.HashString(this) + "::Close() shutdown returned errorCode:" + errorCode.ToString());
//
// skip good cases: success, socket already closed
//
if (errorCode!=SocketErrors.Success && errorCode!=SocketErrors.WSAENOTSOCK) {
//
// update our internal state after this socket error and throw
//
UpdateStatusAfterSocketError();
throw new SocketException(errorCode);
}
SetToDisconnected();
}