vidgear: Python 2 MultiServer Mode, ValueError: [ERROR]: Failed to connect address
I use the testing branch of vidgear to use use Multiserver Mode.
running this part of code on a raspberry pi 3B + that transmits the video from a USB camera to a computer.
from vidgear.gears import NetGear
from vidgear.gears import CamGear
import cv2
#Open live video stream from device at index 0
stream = cv2.VideoCapture(0)
#activate multiserver_mode
options = {'multiserver_mode': True, 'flag' : 0, 'copy' : False, 'track' : False}
#change following IP address '192.168.1.xxx' with Client's IP address and assign unique port address(for e.g 5566).
server = NetGear(address = 192.168.x.x, port = '5566', protocol = 'tcp', pattern = 2, receive_mode = False, **options) # and keep rest of settings similar to Client
# infinite loop until [Ctrl+C] is pressed
while True:
try:
(grabbed, frame) = stream.read()
# read frames
# check if frame is not grabbed
if not grabbed:
#if True break the infinite loop
break
# do something with frame and data(to be sent) here
text = "Hello, I'm Server-1 at Port Address: 5566."
# send frame and data through server
server.send(frame, message = text)
except KeyboardInterrupt:
#break the infinite loop
break
# safely close video stream.
stream.release()
# safely close server-1
server.close()
I get this error: ValueError: [ERROR]: Failed to connect address: tcp://192.168.0.107:5566 and pattern: 2! Kindly recheck all parameters.
Tracking the problem, it originates in line 477:
self.msg_socket.bind(protocol+'://' + str(address) + ':' + str(port))
testing this code in python3 works fine.
Is the problem due to the python version?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (11 by maintainers)
Commits related to this issue
- Major Updates and Bugfixes for NetGear API - Updates: - Introducing Bi-Directional mode for bi-directional data transmission in NetGear(#75) - Added new `return_data` parameter to `recv()` func... — committed to abhiTronix/vidgear by abhiTronix 5 years ago
- Merge pull request #76 from abhiTronix/development Major Updates and Bugfixes for NetGear API - Updates: - Introducing exclusive Bi-Directional Mode for bidirectional data transmission(#75) ... — committed to abhiTronix/vidgear by abhiTronix 5 years ago
@julio16101 This is also a bug with NetGear API due to its broken implementation. This also been fixed in the next PR. Thanks for reporting.
As I mentioned earlier, the problem I mention is in my raspberry pi 3B +.
I am using Raspbian as an operating system (Linux).
My Python version is 2.7.13
On my computer where I receive the video, I am using a version of ubuntu 16.04 LTS although in it I have no problem.