NetGear API¶
Overview¶
NetGear is exclusively designed to transfer video frames synchronously and asynchronously between interconnecting systems over the network in real-time.
NetGear implements a high-level wrapper around PyZmQ python library that contains python bindings for ZeroMQ - a high-performance asynchronous distributed messaging library that provides a message queue, but unlike message-oriented middleware, its system can run without a dedicated message broker.
NetGear also enables real-time JPEG Frame Compression capabilities for boosting performance significantly while sending video-frames over the network in real-time.
Lazy Pirate pattern in NetGear API
NetGear API now internally implements robust Lazy Pirate pattern (auto-reconnection) for its synchronous messaging patterns(zmq.PAIR
& zmq.REQ/zmq.REP
) at both Server and Client ends, where its API instead of doing a blocking receive, will:
- Poll the socket and receive from it only when it's sure a reply has arrived.
- Attempt to reconnect, if no reply has arrived within a timeout period.
- Abandon the connection if there is still no reply after several requests.
Netgear API also provides max_retries
and request_timeout
like attributes for controlling this polling.
NetGear as of now seamlessly supports three ZeroMQ messaging patterns:
- zmq.PAIR (ZMQ Pair Pattern)
- zmq.REQ/zmq.REP (ZMQ Request/Reply Pattern)
- zmq.PUB/zmq.SUB (ZMQ Publish/Subscribe Pattern)
whereas the supported protocol are: tcp
and ipc
.
Modes of Operation¶
Primary Modes¶
NetGear API primarily has two modes of operations:
-
Send Mode: which employs
send()
function to send video frames over the network in real-time. Activate this mode by setting parameterreceive_mode = False
. -
Receive Mode: which employs
recv()
function to receive frames, sent over the network with Send Mode in real-time. Activate this mode by setting parameterreceive_mode = True
.
Exclusive Modes¶
In addition to the primary modes, NetGear API also offers application-specific Exclusive Modes:
Also, checkout this compatibility chart for these modes interoperability.
A. Multi-Servers Mode¶
- In this exclusive mode, NetGear API robustly handles multiple servers at once, thereby providing seamless access to frames and unidirectional data transfer from multiple Servers/Publishers across the network in real-time.
- Each new Server on the network can be identified on the client's end by using its unique port address.
- You can learn about this mode here ➶
B. Multi-Clients Mode¶
- In this exclusive mode, NetGear API robustly handles multiple clients at once, thereby providing seamless access to frames and unidirectional data transfer to multiple Client/Consumers across the network in real-time.
- Each new Client on the network can be uniquely identified on the Server's end by using its unique port address.
- You can learn about this mode here ➶
C. Bidirectional Mode¶
- This exclusive mode provides seamless support for bidirectional data transmission between between Server and Client along with video frames.
- Using this mode, the user can now send or receive any data(of any datatype) between Server and Client easily in real-time.
- You can learn more about this mode here ➶
D. SSH Tunneling Mode¶
- This exclusive mode allows you to connect NetGear via secure SSH connection over the untrusted network and access its intranet services across firewalls.
- This mode implements SSH Remote Port Forwarding which enables accessing Host(client) machine outside the network by exposing port to the public Internet.
- You can learn more about this mode here ➶
E. Secure Mode¶
- In this exclusive mode, NetGear API provides easy access to powerful, smart & secure ZeroMQ's Security Layers that enables strong encryption on data, and unbreakable authentication between the Server and Client with the help of custom certificates/keys that brings cheap, standardized privacy and authentication for distributed systems over the network.
- You can learn more about this mode here ➶
Important Information
-
When compiling/installing pyzmq on UNIX systems, it is generally recommended that zeromq binaries to be installed separately, via
homebrew, apt, yum, etc.
as follows:# Debian-based sudo apt-get install libzmq3-dev # RHEL-based sudo yum install libzmq3-devel # OSX-based brew install zeromq
If zeromq binaries are not found, pyzmq will try to build
libzmq
as a Python Extension, though this is not guaranteed to work! -
It is advised to enable logging (
logging = True
) on the first run, to easily identify any runtime errors. -
Kindly go through each given Usage Examples thoroughly, any incorrect settings/parameter may result in errors or no output at all.
-
Only either of two functions (i.e.
send()
andrecv()
) can be accessed at any given instance based on activated primary mode selected during NetGear API initialization. Trying to access wrong function in incorrect mode (for e.g usingsend()
function in Receive Mode), will result inValueError
. -
Frame Compression is enabled by default in NetGear along with fast dct and compression-quality at 90% in all connections.
Usage Examples¶
After going through NetGear Usage Examples, Checkout more bonus examples here ➶
Parameters¶
References¶
FAQs¶