SocketAsyncEventArgs 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드
| Name | Description |
|---|---|
| SocketAsyncEventArgs() |
빈 SocketAsyncEventArgs 인스턴스를 만듭니다. |
| SocketAsyncEventArgs(Boolean) |
SocketAsyncEventArgs 을(를) 초기화합니다. |
SocketAsyncEventArgs()
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
빈 SocketAsyncEventArgs 인스턴스를 만듭니다.
public:
SocketAsyncEventArgs();
public SocketAsyncEventArgs();
Public Sub New ()
예외
플랫폼은 지원되지 않습니다.
예제
다음 코드 예제는 재사용 가능한 SocketAsyncEventArgs 개체의 컬렉션을 나타냅니다.
// Represents a collection of reusable SocketAsyncEventArgs objects.
class SocketAsyncEventArgsPool
{
Stack<SocketAsyncEventArgs> m_pool;
// Initializes the object pool to the specified size
//
// The "capacity" parameter is the maximum number of
// SocketAsyncEventArgs objects the pool can hold
public SocketAsyncEventArgsPool(int capacity)
{
m_pool = new Stack<SocketAsyncEventArgs>(capacity);
}
// Add a SocketAsyncEventArg instance to the pool
//
//The "item" parameter is the SocketAsyncEventArgs instance
// to add to the pool
public void Push(SocketAsyncEventArgs item)
{
if (item == null) { throw new ArgumentNullException("Items added to a SocketAsyncEventArgsPool cannot be null"); }
lock (m_pool)
{
m_pool.Push(item);
}
}
// Removes a SocketAsyncEventArgs instance from the pool
// and returns the object removed from the pool
public SocketAsyncEventArgs Pop()
{
lock (m_pool)
{
return m_pool.Pop();
}
}
// The number of SocketAsyncEventArgs instances in the pool
public int Count
{
get { return m_pool.Count; }
}
}
설명
이 생성자를 호출한 후 모든 속성의 기본값은 다음과 같습니다.
개체 참조가 null이 됩니다.
정수가 반환되는 속성은 0을 반환합니다.
속성은 LastOperation 같을 것입니다 None.
속성은 SendPacketsFlags 플래그가 사용되지 않음을 지정하는 것과 같습니다 TransmitFileOptions.UseDefaultWorkerThread.
속성은 SocketFlags 같을 것입니다 None.
호출자는 적절한 비동기 소켓(xxxAsync) 메서드에 개체를 전달하기 전에 적절한 속성을 설정해야 합니다.
적용 대상
SocketAsyncEventArgs(Boolean)
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
- Source:
- SocketAsyncEventArgs.cs
SocketAsyncEventArgs 을(를) 초기화합니다.
public:
SocketAsyncEventArgs(bool unsafeSuppressExecutionContextFlow);
public SocketAsyncEventArgs(bool unsafeSuppressExecutionContextFlow);
new System.Net.Sockets.SocketAsyncEventArgs : bool -> System.Net.Sockets.SocketAsyncEventArgs
Public Sub New (unsafeSuppressExecutionContextFlow As Boolean)
매개 변수
- unsafeSuppressExecutionContextFlow
- Boolean
실행 컨텍스트의 캡처 및 흐름을 사용하지 않도록 설정할지 여부입니다. 실행 컨텍스트 흐름은 상위 계층에서 처리되는 경우에만 사용하지 않도록 설정해야 합니다.