
APDCAM User’s Guide
Page 30/32
TS0_Server.SetListeningPort(57000);
TS0_Server.SetBuffer(lpMemReserved0, MEMORY_REQUESTED);
HANDLE hEvent0 = CreateEvent(NULL, TRUE, FALSE, NULL);
if
(hEvent0 == NULL)
throw
new
CExcp(0);
TS0_Server.SetPacketSize(stream_1_pack
sizeof
(CW_FRAME));
TS0_Server.SetNotification(requestedData0, hEvent0);
TS0_Server.Reset();
if
(requestedData0 != 0)
{
if
(TS0_Server.Start(
true
))
{
_tprintf(_T(
"TS0 started\n"
));
}
else
{
_tprintf(_T(
"Could not start TS0\n"
));
}
}
Here 57000 is the port number, separate numbers should be used for the four streams.
In the lpMemReserved0 the address of the reviously allocated memory is given, the
memory size is in MEMORY_REQUESTED in bytes. The stream_1_packetsize parame-
ter is the data size for measurement data in the UDP packets also used as input parameter
of sendTS(). As it can be seen from the code the full UDP packet data size is the meas-
urement data size plus a header which contains a packet counter and other infromation.
This header is also stored with the measurement data in memory, for details see Section
3.6.1.
In the example above the SetNotification() call specifies a data amount and an event.
This event will be called when the given amount of data has been received. The wait for
the event use e.g:
DWORD res = WaitForSingleObject(hEvent0, INFINITE);
After receiving the desired amount of data the server has to be stopped:
TS0_Server.Stop();
DontSendTS
Declaration:
CAMCONTROL_API
int
DontSendTS();
Description:
This function should be called to stop data transfer through the 4 streams of the DAQ
module.