agsh / onvif

ONVIF node.js implementation
http://agsh.github.io/onvif/
MIT License
692 stars 234 forks source link

Somebody help me! Error: read ECONNRESET #196

Closed dragonview closed 2 years ago

dragonview commented 3 years ago

Somebody help me!

camera param: host:192.168.188.68 port:8000 connect error: { Error: read ECONNRESET at TCP.onread (net.js:660:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

the cam discovery info: Cam { _events: { newListener: [Function: bound ] }, _eventsCount: 1, _maxListeners: undefined, hostname: '192.168.188.68', username: undefined, password: undefined, port: '8000', path: '/onvif/device_service', timeout: 120000, agent: false, preserveAddress: false, events: {}, xaddrs: [ Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/device_service', path: '/onvif/device_service', href: 'http://192.168.188.68:8000/onvif/device_service' } ], timeShift: 1623376693788, services: [ { namespace: 'http://www.onvif.org/ver10/device/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/device_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/media/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/media_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/events/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/event_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver20/ptz/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/ptz_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver20/imaging/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/image_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver20/analytics/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/analytics_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/recording/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/recording_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/search/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/search_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/replay/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/replay_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/deviceIO/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/deviceIO_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/thermal/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/thermal_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/credential/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/credential_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/accessrules/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/accessrules_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/schedule/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/schedule_service', capabilities: [Object], version: [Object] }, { namespace: 'http://www.onvif.org/ver10/receiver/wsdl', XAddr: 'http://192.168.188.68:8000/onvif/receiver_service', capabilities: [Object], version: [Object] } ], uri: { device: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/device_service', path: '/onvif/device_service', href: 'http://192.168.188.68:8000/onvif/device_service' }, media: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/media_service', path: '/onvif/media_service', href: 'http://192.168.188.68:8000/onvif/media_service' }, events: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/event_service', path: '/onvif/event_service', href: 'http://192.168.188.68:8000/onvif/event_service' }, ptz: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/ptz_service', path: '/onvif/ptz_service', href: 'http://192.168.188.68:8000/onvif/ptz_service' }, imaging: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/image_service', path: '/onvif/image_service', href: 'http://192.168.188.68:8000/onvif/image_service' }, analytics: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/analytics_service', path: '/onvif/analytics_service', href: 'http://192.168.188.68:8000/onvif/analytics_service' }, recording: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/recording_service', path: '/onvif/recording_service', href: 'http://192.168.188.68:8000/onvif/recording_service' }, search: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/search_service', path: '/onvif/search_service', href: 'http://192.168.188.68:8000/onvif/search_service' }, replay: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/replay_service', path: '/onvif/replay_service', href: 'http://192.168.188.68:8000/onvif/replay_service' }, deviceIO: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/deviceIO_service', path: '/onvif/deviceIO_service', href: 'http://192.168.188.68:8000/onvif/deviceIO_service' }, thermal: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/thermal_service', path: '/onvif/thermal_service', href: 'http://192.168.188.68:8000/onvif/thermal_service' }, credential: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/credential_service', path: '/onvif/credential_service', href: 'http://192.168.188.68:8000/onvif/credential_service' }, accessrules: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/accessrules_service', path: '/onvif/accessrules_service', href: 'http://192.168.188.68:8000/onvif/accessrules_service' }, schedule: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/schedule_service', path: '/onvif/schedule_service', href: 'http://192.168.188.68:8000/onvif/schedule_service' }, receiver: Url { protocol: 'http:', slashes: true, auth: null, host: '192.168.188.68:8000', port: '8000', hostname: '192.168.188.68', hash: null, search: null, query: null, pathname: '/onvif/receiver_service', path: '/onvif/receiver_service', href: 'http://192.168.188.68:8000/onvif/receiver_service' } }, media2Support: false }

RogerHardiman commented 3 years ago

Q1 - what camera are you connecting to Q2 - what version of the ONVIF Library - ie when did you clone it from github and which branch (eg master or roger-branch)

dragonview commented 3 years ago

Q1 - what camera are you connecting to A small brand of ip camera, lan ip:192.168.188.68

Q2 - what version of the ONVIF Library - ie when did you clone it from github and which branch (eg master or roger-branch) ONVIF version:2.4 GitHub: master,2021/6/1

RogerHardiman commented 3 years ago

In the Cam object you put in the first post, I can see the username is null and the password is null.

ONVIF allows some commands to be used without a username and password. One of them is GetCapabilities, which returns all the XAddr information you can see on the Cam Object. But after calling GetCapabilities, the rest of the ONVIF commands need a username and password, unless you have a very cheap ONVIF camera that does not implement security.

We normally get a SOAP error back when the username is invalid (or missing). Maybe your camera just closes the network socket giving the ECONNRESET

I'd need to have remove access to the camera to verify this.

What happens when you do have a username and password?