Dahua Python SDK: Connecting via P2P

pramonty

n3wb
Mar 9, 2025
1
0
India
Hi All
I am using Dahua's python sdk (General_NetSDK_Eng_Python_win64_IS_V3.058.0000004.0.R.241125) from their official website (Dahua Partner Alliances) to tinker with my DVR. The following code snippet from their RealPlayDemo shows how they are connecting using Ip and port:
def login(self):
stuInParam = NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY()
stuInParam.dwSize = sizeof(NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY)
stuInParam.szIP = b'MyLocalIp'
stuInParam.nPort = MyPort
stuInParam.szUserName = b'MyUserName'
stuInParam.szPassword = b'MyPassword'
stuInParam.emSpecCap = EM_LOGIN_SPAC_CAP_TYPE.TCP
stuInParam.pCapParam = None

stuOutParam = NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY()
stuOutParam.dwSize = sizeof(NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY)

self.loginID, device_info, error_msg = self.sdk.LoginWithHighLevelSecurity(stuInParam, stuOutParam)

if self.loginID != 0:
print(f'Login Successful, with loginId: {self.loginID}')
else:
print(f'Could not login, as error: {error_msg}')

Now, How can I modify the code to connect using SerialNumber, through P2P? I am just starting out with the sdk, so don't have much knowledge about it. Let me know if you need any more information from me.
It would be great if someone could help me in figuring this out. Thanks!!