Skip to content

NetGear API Parameters

address

This parameter sets the valid Network IP address for Server/Client. Network addresses are unique identifiers across the network.

Data-Type: String

Default Value: Its default value is based on selected primary mode, i.e 'localhost' for Send Mode and '*' for Receive Mode on a local machine.

Usage:

NetGear(address="192.168.0.145")

 

port

This parameter sets the valid Network Port for Server/Client. Network port is a number that identifies one side of a connection between two devices on the network and is used determine to which process or application a message should be delivered.

Exception for Exclusive Modes

In Multi-Servers Mode:

  • A unique port number MUST be assigned to each Server on the network using this parameter.
  • At Client end, a List/Tuple of all available Server(s) ports MUST be assigned using this same parameter.
  • See its usage example here ➶.

In Multi-Client Mode:

  • A unique port number MUST be assigned to each Client on the network using this parameter.
  • At Server end, a List/Tuple of all available Client(s) ports MUST be assigned using this same parameter.
  • See its usage example here ➶.

Data-Type: String or List/Tuple

Default Value: Its default value is '5555'

Usage:

NetGear(port="5575")

 

protocol

This parameter sets the valid messaging protocol between server and client. A network protocol is a set of established rules that dictates how to format, transmit and receive data so computer network devices - from servers and routers to endpoints - can communicate regardless of the differences in their underlying infrastructures, designs or standards. Supported protocol are: 'tcp' and 'ipc'.

Data-Type: String

Default Value: Its default value is 'tcp'

Usage:

NetGear(protocol="ipc")

 

pattern

This parameter sets the supported messaging pattern(flow of communication) between server and client. Messaging patterns are the network-oriented architectural pattern that describes the flow of communication between interconnecting systems. NetGear provides access to ZeroMQ's pre-optimized sockets which enables you to take advantage of these patterns.

Data-Type: Integer

Default Value: Its default value is 0 (i.e zmq.PAIR).

Supported ZMQ patterns

All supported ZMQ patterns for NetGear are:

  • 0 (.i.e. zmq.PAIR): In this pattern, the communication is bidirectional. There is no specific state stored within the socket. There can only be one connected peer. The server listens on a certain port and a client connects to it.
  • 1 (.i.e. zmq.REQ/zmq.REP): In this pattern, it employs ZMQ REQ sockets that can connect to many servers. The requests will be interleaved or distributed to both the servers. socket zmq.REQ will block send unless it has successfully received a reply back and socket zmq.REP will block on recv() unless it has received a request.
  • 2 (.i.e. zmq.PUB/zmq.SUB): It is an another classic pattern where senders of messages, called publishers, do not program the messages to be sent directly to specific receivers, called subscribers. Messages are published without the knowledge of what or if any subscriber of that knowledge exists. A ZMQ.SUB can connect to multiple ZMQ.PUB (publishers). No single publisher overwhelms the subscriber. The messages from both publishers are interleaved.

Usage:

NetGear(pattern=1) # sets zmq.REQ/zmq.REP pattern

 

receive_mode

This parameter select the Netgear's Mode of operation. It basically activates Receive Mode(if True) and Send Mode(if False). Furthermore, recv() method will only work when this flag is enabled(i.e. Receive Mode), whereas send() method will only work when this flag is disabled(i.e.Send Mode).

Data-Type: Boolean

Default Value: Its default value is False(i.e. Send Mode is activated by default).

Usage:

NetGear(receive_mode=True) # activates Recieve Mode

 

options

This parameter provides the flexibility to alter various NetGear API's internal properties, modes, and some PyZMQ flags.

Data-Type: Dictionary

Default Value: Its default value is {}

Usage:

Supported dictionary attributes for NetGear API

  • multiserver_mode (boolean) : This internal attribute activates the exclusive Multi-Servers Mode, if enabled(True).

  • multiclient_mode (boolean) : This internal attribute activates the exclusive Multi-Clients Mode, if enabled(True).

  • secure_mode (integer) : This internal attribute selects the exclusive Secure Mode. Its possible values are: 0(i.e. Grassland(no security)) or 1(i.e. StoneHouse) or 2(i.e. IronHouse).

  • bidirectional_mode (boolean) : This internal attribute activates the exclusive Bidirectional Mode, if enabled(True).

  • ssh_tunnel_mode (string) : This internal attribute activates the exclusive SSH Tunneling Mode at the Server-end only.

  • ssh_tunnel_pwd (string): In SSH Tunneling Mode, This internal attribute sets the password required to authorize Host for SSH Connection at the Server-end only. More information can be found here ➶

  • ssh_tunnel_keyfile (string): In SSH Tunneling Mode, This internal attribute sets path to Host key that provide another way to authenticate host for SSH Connection at the Server-end only. More information can be found here ➶

  • custom_cert_location (string) : In Secure Mode, This internal attribute assigns user-defined location/path to directory for generating/storing Public+Secret Keypair necessary for encryption. More information can be found here ➶

  • overwrite_cert (boolean) : In Secure Mode, This internal attribute decides whether to overwrite existing Public+Secret Keypair/Certificates or not, at the Server-end only. More information can be found here ➶

  • jpeg_compression(bool/str): This internal attribute is used to activate(if True)/deactivate(if False) JPEG Frame Compression as well as to specify incoming frames colorspace with compression. By default colorspace is BGR and compression is enabled(True). More information can be found here ➶

  • jpeg_compression_quality(int/float): This internal attribute controls the JPEG quantization factor in JPEG Frame Compression. Its value varies from 10 to 100 (the higher is the better quality but performance will be lower). Its default value is 90. More information can be found here ➶

  • jpeg_compression_fastdct(bool): This internal attributee if True, use fastest DCT method that speeds up decoding by 4-5% for a minor loss in quality in JPEG Frame Compression. Its default value is also True. More information can be found here ➶

  • jpeg_compression_fastupsample(bool): This internal attribute if True, use fastest color upsampling method. Its default value is False. More information can be found here ➶

  • max_retries(integer): This internal attribute controls the maximum retries before Server/Client exit itself, if it's unable to get any response/reply from the socket before a certain amount of time, when synchronous messaging patterns like (zmq.PAIR & zmq.REQ/zmq.REP) are being used. It's value can anything greater than 0, and its default value is 3.

  • request_timeout(integer): This internal attribute controls the timeout value (in seconds), after which the Server/Client exit itself with Nonetype value if it's unable to get any response/reply from the socket, when synchronous messaging patterns like (zmq.PAIR & zmq.REQ/zmq.REP) are being used. It's value can anything greater than 0, and its default value is 10 seconds.

  • subscriber_timeout(integer): Similar to request_timeout, this internal attribute also controls the timeout value (in seconds) but for non-synchronous zmq.PUB/zmq.SUB pattern in compression mode, after which the Client(Subscriber) exit itself with Nonetype value if it's unable to get any response from the socket. It's value can anything greater than 0, and its disabled by default (meaning the client will wait forever for response).

  • flag(integer): This PyZMQ attribute value can be either 0 or zmq.NOBLOCK( i.e. 1). More information can be found here ➶.

  • copy(boolean): This PyZMQ attribute selects if message be received in a copying or non-copying manner. If False a object is returned, if True a string copy of the message is returned.

  • track(boolean): This PyZMQ attribute check if the message is tracked for notification that ZMQ has finished with it. (ignored if copy=True).

The desired attributes can be passed to NetGear API as follows:

# formatting parameters as dictionary attributes
options = {
    "secure_mode": 2,
    "custom_cert_location": "/home/foo/foo1/foo2",
    "overwrite_cert": True,
    "flag": 0,
    "copy": False,
    "track": False,
}
# assigning it
NetGear(logging=True, **options)

 

logging

This parameter enables logging (if True), essential for debugging.

Data-Type: Boolean

Default Value: Its default value is False.

Usage:

NetGear_Async(logging=True)

 


Last update: September 3, 2023