NET_DVR_StartListen_V30

Register callback function for receiving alarm/event information and start listening (supports multiple threads).

API Definition

LONG NET_DVR_StartListen_V30(
  char           *sLocalIP,
  WORD           wLocalPort,
  MSGCallBack    DataCallback,
  void           *pUserData
);

Parameters

sLocalIP

[IN] IP address of local PC. It can be set to null.

wLocalPort

[IN] Listening port No. of local PC. It is configured by user, and it should be the same with that of device.

DataCallback

[IN] Alarm/event information callback function, see details in MSGCallBack.

pUserData

[IN] User data.

Return Values

Return -1 for failure, and return other values for the handle parameters of NET_DVR_StopListen_V30.

If -1 is returned, you can call NET_DVR_GetLastError to get the error code.

The available error codes of this API are 0, 3, 6, 12, 17, 41, 44, 47, 72, and 75. See details in the Device Network SDK Errors.

Remarks

  • To receive the alarm/event information sent by device, you should set the management host server address or listening host server address of device to the IP address of PC (which is same with the sLocalIP), or set the management host server port or listening host server port to the listening port No. of PC (which is same with the wLocalPort).

  • The callback function in this API is prior to other callback functions, that is, if the callback function is configured in this API, other callback functions will not receive the alarm information. All the device alarm information is returned in same callback function, and you can distinguish the devices via the alarm device information (pAlarmInfo).