InetServerDequeue Function  
 
BOOL WINAPI InetServerDequeue(
  SOCKET hServer,  
  BOOL bRemove,  
  LPVOID lpvItemData,  
  LPDWORD lpdwItemSize  
);

The InetServerDequeue function retrieves an item from the specified server queue.

This function has been deprecated and should no longer be used in new applications.

Parameters

hServer
Handle to the server socket.
bRemove
A boolean flag which specifies if the item should be removed from the queue. If this parameter is non-zero, the item will be removed from the queue. If this parameter is zero, the item will not be removed from the queue. This parameter is ignored if the lpvItemData parameter is NULL.
lpvItemData
The buffer that will contain the item data when the function returns. If this parameter is NULL, then no item data will be copied and the item will not be removed from the queue, however the size of the item will be returned in the unsigned integer pointed to by the lpdwItemSize parameter.
lpdwItemSize
A pointer to an unsigned integer where the initial value specifies the maximum number of bytes that may be copied into the item buffer. When the function returns, this parameter is updated to specify the actual size of the item. This parameter cannot be NULL.

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call InetGetLastError.

Remarks

The InetServerDequeue function retrieves an item to the server's internal FIFO (first in, first out) queue. To dynamically determine the size of the next item in the queue, you can call this function twice. First, call the function with the lpvItemData parameter as a NULL pointer, and the size of the item will be stored in the unsigned integer value pointed to by the lpdwItemSize parameter. Next, allocate that amount of memory, and call the function again, passing the pointer to the newly allocated memory.

If the bRemove parameter is non-zero, the item is removed from the queue and the memory that was allocated for it is released. If the bRemove parameter is zero, then a copy of the item data is returned, but it is not removed from the queue. This allows an application to peek at the next item in the queue without removing it. The server queue functions are thread-safe and each update to the queue is an atomic operation. This enables an application to easily exchange information with other client sessions, or even other servers.

To obtain the number of items in the server FIFO queue, use the InetGetServerQueueCount function. To remove all items from the server queue, use the InetClearServerQueue function.

The socket handle for the server must be one that was created using the InetServerStart function, and cannot be a socket that was created using the InetListen or InetListenEx functions.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cswsock12.h
Import Library: cswskv12.lib

See Also