本文整理汇总了C++中PDSOCKET::GetSocketHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ PDSOCKET::GetSocketHandle方法的具体用法?C++ PDSOCKET::GetSocketHandle怎么用?C++ PDSOCKET::GetSocketHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDSOCKET
的用法示例。
在下文中一共展示了PDSOCKET::GetSocketHandle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddOverlappedOperation
INT
DWORKERTHREAD::QueueOverlappedTransmitFile(
PDSOCKET Socket,
HANDLE hFile,
DWORD nNumberOfBytesToWrite,
DWORD nNumberOfBytesPerSend,
LPWSAOVERLAPPED UserOverlappedStruct,
LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
DWORD dwReserved,
LPINT Errno
)
{
INT ReturnCode;
PINTERNALOVERLAPPEDSTRUCT OverlappedStruct;
ReturnCode = SOCKET_ERROR;
*Errno = WSAENOBUFS;
OverlappedStruct =
gOverlappedManager->AllocateOverlappedStruct();
if (OverlappedStruct){
OverlappedStruct->iolOperationType = TRANSMIT_FILE;
OverlappedStruct->iolSocket = Socket->GetSocketHandle ();
OverlappedStruct->iolProvider = Socket->GetDProvider();
OverlappedStruct->iolProviderSocket = Socket->GetProviderSocket ();
OverlappedStruct->iolUserOverlappedStruct = UserOverlappedStruct;
OverlappedStruct->iolUserCompletionRoutine = NULL;
OverlappedStruct->iolFileHandle = hFile;
OverlappedStruct->iolBytesToWrite = nNumberOfBytesToWrite;
OverlappedStruct->iolBytesPerSend = nNumberOfBytesPerSend;
if (lpTransmitBuffers)
OverlappedStruct->iolTransmitBuffers = *lpTransmitBuffers;
else
OverlappedStruct->iolTransmitBuffers.HeadLength =
OverlappedStruct->iolTransmitBuffers.TailLength = 0;
OverlappedStruct->iolReserved = dwReserved;
AddOverlappedOperation(
Socket,
OverlappedStruct);
*Errno = WSA_IO_PENDING;
} //if
return(ReturnCode);
}
示例2: buffer
INT
DWORKERTHREAD::QueueOverlappedSend(
PDSOCKET Socket,
LPWSABUF UserBuffers,
DWORD UserBufferCount,
LPDWORD UserBytesSent,
DWORD UserFlags,
LPWSAOVERLAPPED UserOverlappedStruct,
LPWSAOVERLAPPED_COMPLETION_ROUTINE UserCompletionRoutine,
LPWSATHREADID UserThreadId,
LPINT Errno
)
/*++
Routine Description:
this routine allocates an internal overlapped structure stores its
arguments in the allocated structure and enqueues the structure for the
worker thread to complet the I/O operation.
Arguments:
Socket - Socket object
UserBuffers - The pointer to the user buffer(s).
UserBufferCount - The number of user buffers.
UserBytesSent - The pointer to the user BytesSent parameter.
UserFlags - The user flags .
UserOverlappedStruct - The user overlapped struct pointer.
UserCompletionRoutine - The user overlapped completion routine.
UserThreadId - The user thread ID.
InternalBuffers - A pointer to our internal buffer(s).
InternalBufferCount - The number of internal buffers.
Errno - A pointer to the user errno parameter.
Return Value:
NO_ERROR on success else a valid winsock2 error code.
--*/
{
INT ReturnCode;
PINTERNALOVERLAPPEDSTRUCT OverlappedStruct;
ReturnCode = SOCKET_ERROR;
*Errno = WSAENOBUFS;
OverlappedStruct =
gOverlappedManager->AllocateOverlappedStruct();
if (OverlappedStruct){
OverlappedStruct->iolOperationType = WSP_SEND;
OverlappedStruct->iolSocket = Socket->GetSocketHandle ();
OverlappedStruct->iolProvider = Socket->GetDProvider();
OverlappedStruct->iolProviderSocket = Socket->GetProviderSocket ();
OverlappedStruct->iolUserOverlappedStruct = UserOverlappedStruct;
OverlappedStruct->iolUserCompletionRoutine = UserCompletionRoutine;
OverlappedStruct->iolUserThreadId = *UserThreadId;
if (UserBufferCount<=MAX_FAST_BUFS)
memcpy (OverlappedStruct->iolUserBuffers, UserBuffers,
sizeof (WSABUF)*UserBufferCount);
else {
OverlappedStruct->iolpUserBuffers = new WSABUF[UserBufferCount];
if (OverlappedStruct->iolpUserBuffers==NULL) {
gOverlappedManager->FreeOverlappedStruct (
&OverlappedStruct->iolInternalOverlappedStruct);
return ReturnCode;
}
memcpy (OverlappedStruct->iolpUserBuffers, UserBuffers,
sizeof (WSABUF)*UserBufferCount);
}
OverlappedStruct->iolUserBufferCount = UserBufferCount;
OverlappedStruct->iolFlags = UserFlags;
AddOverlappedOperation(
Socket,
OverlappedStruct);
*Errno = WSA_IO_PENDING;
} //if
return(ReturnCode);
}