class_docstr: 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 supports real-time Frame Compression capabilities for optimizing performance while sending the frames directly over the network, by encoding the frame before sending
  it and decoding it on the client's end automatically in real-time.
  
  !!! info
      NetGear API now internally implements robust *Lazy Pirate pattern* (auto-reconnection) for its synchronous messaging patterns _(i.e. `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 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`_.
  
  ??? tip "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._
  
          * **Receive Mode:** _which employs `recv()` function to receive frames, sent over the network with *Send Mode* in real-time. The mode sends back confirmation when the
          frame is received successfully in few patterns._
  
      * **Exclusive Modes**
  
          In addition to these primary modes, NetGear API offers applications-specific Exclusive Modes:
  
          * **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._
  
          * **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._
  
          * **Bidirectional Mode:** _This exclusive mode **provides seamless support for bidirectional data transmission between between Server and Client along with video frames**._
  
          * **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._
class_docstr_tok: ["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","supports","real-time","Frame","Compression","capabilities","for","optimizing","performance","while","sending","the","frames","directly","over","the","network",",","by","encoding","the","frame","before","sending","it","and","decoding","it","on","the","client","'s","end","automatically","in","real-time",".","!","!","!","info","NetGear","API","now","internally","implements","robust","*","Lazy","Pirate","pattern","*","(","auto-reconnection",")","for","its","synchronous","messaging","patterns","_","(","i.e",".","`","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","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","`","_",".","?","?","?","tip","``","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._","*","*","*","Receive","Mode",":","*","*","_which","employs","`","recv","(",")","`","function","to","receive","frames",",","sent","over","the","network","with","*","Send","Mode","*","in","real-time",".","The","mode","sends","back","confirmation","when","the","frame","is","received","successfully","in","few","patterns._","*","*","*","Exclusive","Modes","*","*","In","addition","to","these","primary","modes",",","NetGear","API","offers","applications-specific","Exclusive","Modes",":","*","*","*","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._","*","*","*","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._","*","*","*","Bidirectional","Mode",":","*","*","_This","exclusive","mode","*","*","provides","seamless","support","for","bidirectional","data","transmission","between","between","Server","and","Client","along","with","video","frames","*","*","._","*","*","*","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._"]
docstr: A Receiver end method, that extracts received frames synchronously from monitored deque, while maintaining a
  fixed-length frame buffer in the memory, and blocks the thread if the deque is full.
  
  Parameters:
      return_data (any): inputs return data _(of any datatype)_, for sending back to Server.
  
  **Returns:** A n-dimensional numpy array.
docstr_tok: ["A","Receiver","end","method",",","that","extracts","received","frames","synchronously","from","monitored","deque",",","while","maintaining","a","fixed-length","frame","buffer","in","the","memory",",","and","blocks","the","thread","if","the","deque","is","full",".","Parameters",":","return_data","(","any",")",":","inputs","return","data","_","(","of","any","datatype",")","_",",","for","sending","back","to","Server",".","*","*","Returns",":","*","*","A","n-dimensional","numpy","array","."]
code: def recv(self, return_data=None):
      """
      A Receiver end method, that extracts received frames synchronously from monitored deque, while maintaining a
      fixed-length frame buffer in the memory, and blocks the thread if the deque is full.
  
      Parameters:
          return_data (any): inputs return data _(of any datatype)_, for sending back to Server.
  
      **Returns:** A n-dimensional numpy array.
      """
      # check whether `receive mode` is activated
      if not (self.__receive_mode):
          # raise value error and exit
          self.__terminate = True
          raise ValueError(
              "[NetGear:ERROR] :: `recv()` function cannot be used while receive_mode is disabled. Kindly refer vidgear docs!"
          )
  
      # handle Bidirectional return data
      if (self.__bi_mode or self.__multiclient_mode) and not (
          return_data is None
      ):
          self.__return_data = return_data
  
      # check whether or not termination flag is enabled
      while not self.__terminate:
          try:
              # check if queue is empty
              if len(self.__queue) > 0:
                  return self.__queue.popleft()
              else:
                  time.sleep(0.00001)
                  continue
          except KeyboardInterrupt:
              self.__terminate = True
              break
      # otherwise return NoneType
      return None
  
file_path: vidgear/vidgear/gears/netgear.py
imports: import os
  import time
  import string
  import secrets
  import numpy
  import logging
  from threading import Thread
  from collections import deque
  from os.path import expanduser
  from .helper import logger_handler, generate_auth_certificates, check_WriteAccess, check_open_port, import_dependency_safe, logcurr_vidgear_ver
label_desc: Use image node_id 3 for calling the NetGear obj's underlying member method code with example usage: obj.recv(return_data) and returns: None, self