本文整理汇总了C++中PDSOCKET::GetCatalogItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PDSOCKET::GetCatalogItem方法的具体用法?C++ PDSOCKET::GetCatalogItem怎么用?C++ PDSOCKET::GetCatalogItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDSOCKET
的用法示例。
在下文中一共展示了PDSOCKET::GetCatalogItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetErrorCode
int WSAAPI
WSANtohs (
IN SOCKET s,
IN u_short netshort,
OUT u_short FAR * lphostshort
)
/*++
Routine Description:
Arguments:
Returns:
Zero on success else SOCKET_ERROR. The error code is stored with
SetErrorCode().
--*/
{
PDPROCESS Process;
PDTHREAD Thread;
PDSOCKET Socket;
INT ErrorCode;
INT ReturnCode;
PPROTO_CATALOG_ITEM CatalogEntry;
LPWSAPROTOCOL_INFOW ProtocolInfo;
ReturnCode = PROLOG(
&Process,
&Thread,
&ErrorCode);
if (ERROR_SUCCESS != ReturnCode) {
SetLastError(ErrorCode);
return(SOCKET_ERROR);
} //if
if( lphostshort == NULL ) {
SetLastError( WSAEFAULT );
return(SOCKET_ERROR);
}
ErrorCode = DSOCKET::GetCountedDSocketFromSocket(
s, // SocketHandle
& Socket); // DSocket
if(ERROR_SUCCESS == ErrorCode){
CatalogEntry = Socket->GetCatalogItem();
// This is kind of a special case. We are done with the DSOCKET
// object reference and we don't call through to the provider at
// all.
Socket->DropDSocketReference();
ProtocolInfo = CatalogEntry->GetProtocolInfo();
if (LITTLEENDIAN == ProtocolInfo->iNetworkByteOrder) {
*lphostshort = netshort;
} //if
else {
*lphostshort = SWAP_SHORT( netshort );
} //else
} //if
if (ErrorCode != ERROR_SUCCESS) {
SetLastError(ErrorCode);
ReturnCode = SOCKET_ERROR;
}
return(ReturnCode);
}
示例2: WSAHtonl
int WSAAPI
WSAHtonl (
IN SOCKET s,
IN u_long hostlong,
OUT u_long FAR * lpnetlong
)
/*++
Routine Description:
Convert a u_long from a specified host byte order to network byte
order.
Arguments:
s - A descriptor identifying a socket.
hostlong - A 32-bit number in host byte order.
lpnetlong - A pointer to a 32-bit number in network byte order.
Returns:
If no error occurs, WSAHtonl() returns 0. Otherwise, a value of
SOCKET_ERROR is returned.
--*/
{
PDSOCKET Socket;
INT ErrorCode;
PPROTO_CATALOG_ITEM CatalogEntry;
LPWSAPROTOCOL_INFOW ProtocolInfo;
ErrorCode = TURBO_PROLOG();
if (ErrorCode==ERROR_SUCCESS) {
if( lpnetlong == NULL ) {
SetLastError( WSAEFAULT );
return(SOCKET_ERROR);
}
Socket = DSOCKET::GetCountedDSocketFromSocket(s);
if(Socket != NULL){
CatalogEntry = Socket->GetCatalogItem();
ProtocolInfo = CatalogEntry->GetProtocolInfo();
__try {
if (LITTLEENDIAN == ProtocolInfo->iNetworkByteOrder) {
*lpnetlong = hostlong;
} //if
else {
*lpnetlong = SWAP_LONG( hostlong );
} //else
ErrorCode = ERROR_SUCCESS;
}
__except (WS2_EXCEPTION_FILTER()) {
ErrorCode = WSAEFAULT;
}
Socket->DropDSocketReference();
if (ErrorCode==ERROR_SUCCESS)
return ErrorCode;
} //if
else
示例3: WSANtohs
int WSAAPI
WSANtohl (
IN SOCKET s,
IN u_long netlong,
OUT u_long FAR * lphostlong
)
/*++
Routine Description:
Convert a u_long from network byte order to host byte order.
Arguments:
s - A descriptor identifying a socket.
netlong - A 32-bit number in network byte order.
lphostlong - A pointer to a 32-bit number in host byte order.
Returns:
If no error occurs, WSANtohs() returns 0. Otherwise, a value of
SOCKET_ERROR is returned.
--*/
{
PDPROCESS Process;
PDTHREAD Thread;
PDSOCKET Socket;
INT ErrorCode;
INT ReturnCode;
PPROTO_CATALOG_ITEM CatalogEntry;
LPWSAPROTOCOL_INFOW ProtocolInfo;
ReturnCode = PROLOG(
&Process,
&Thread,
&ErrorCode);
if (ERROR_SUCCESS != ReturnCode) {
SetLastError(ErrorCode);
return(SOCKET_ERROR);
} //if
if( lphostlong == NULL ) {
SetLastError( WSAEFAULT );
return(SOCKET_ERROR);
}
ErrorCode = DSOCKET::GetCountedDSocketFromSocket(
s, // SocketHandle
& Socket); // DSocket
if(ERROR_SUCCESS == ErrorCode){
CatalogEntry = Socket->GetCatalogItem();
// This is kind of a special case. We are done with the DSOCKET
// object reference and we don't call through to the provider at
// all.
Socket->DropDSocketReference();
ProtocolInfo = CatalogEntry->GetProtocolInfo();
if (LITTLEENDIAN == ProtocolInfo->iNetworkByteOrder) {
*lphostlong = netlong;
} //if
else {
*lphostlong = SWAP_LONG( netlong );
} //else
} //if
if (ErrorCode != ERROR_SUCCESS) {
SetLastError(ErrorCode);
ReturnCode = SOCKET_ERROR;
}
return(ReturnCode);
}