RFID_STATUS WINAPI RFID_AcceptConnection ( RFID_HANDLE32 *  pReaderHandle,
SOCKET_HANDLE  readerSocket,
LPSERVER_INFO  lpServerInfo,
LPVOID  rsvd 
)

This function accepts an LLRP connection from an RFID reader running in server mode and returns a handle.

Parameters:
[out] pReaderHandle 
Pointer to Handle to the RFID device.
[in] readerSocket 
Socket Handle to the reader initiated connection
[in] lpServerInfo 
Pointer to ServerInfo parameters(timeout and version info)
[in] rsvd 
Reserved for future use
Returns:
If the function succeeds, the return value is RFID_API_SUCCESS If the function fails, the return value is RFID_INVALID_SOCKET an unconnected socket handle is passed RFID_API_PARAM_OUT_OF_RANGE timeout passed is less than 2 seconds(However, zero corresponds to a valid timeout- default LLRP timeout) RFID_API_PARAM_ERROR the version info passed is RFID_VERSION_5_0;
Remarks:
This API accepts the socket handle of the reader connection and returns a readerhandle for this connection whose disconnection and command timeouts are configured from the timeout parameter of the serverInfo structure
See also:
RFID_Connect, RFID_Disconnect, RFID_Reconnect
Remarks:
Example:
RFID_HANDLE32 readerHandle;
SERVER_INFO serverInfo;
serverInfo.timeoutMilliseconds = 2000;
serverInfo.version = RFID_API3_5_1;
RFID_STATUS rfidStatus = RFID_API_SUCCESS;
READER_CAPS readerCaps; 
SOCKET  listeningSocket, acceptedSocket;

// Initialize Winsock.
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);

// Create a SOCKET for listening for incoming connection requests. 
listeningSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listeningSocket == INVALID_SOCKET) 
{
        WSACleanup();
        return;
}
sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(5084);
if (bind(listeningSocket, (SOCKADDR*) &service, sizeof(service)) == SOCKET_ERROR)
{
        closesocket(listeningSocket); 
        return ; 
}
// Connect from a reader to the local IP address at the same LLRP port.The Socket Connection is accepted here and 
// passed to RFID_AcceptConnection to get the ReaderHandle
//
if (listen(listeningSocket, 2) == SOCKET_ERROR)
        return;
acceptedSocket = accept(listeningSocket, NULL, NULL);

if(RFID_API_SUCCESS == RFID_AcceptConnection(&readerHandle, acceptedSocket, &serverInfo, NULL))
{
        // Set trace level
        rfidStatus = RFID_SetTraceLevel(readerHandle, TRACE_LEVEL_ALL);
        // Do something - Configurations, Capabilities, Inventory, Access
        rfidStatus = RFID_GetReaderCaps(readerHandle, &readerCaps);
        printf(" The model name of connected reader is %S", readerCaps.modelName);
        rfidStatus = RFID_Disconnect(readerHandle);
}


Generated on Fri Mar 4 02:25:28 2016 for RFIDAPI3 1.1 C API Documentation by  doxygen 1.5.6