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:
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
- 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 ➶.
- 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:
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:
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 employsZMQ REQ
sockets that can connect to many servers. The requests will be interleaved or distributed to both the servers. socketzmq.REQ
will block send unless it has successfully received a reply back and socketzmq.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. AZMQ.SUB
can connect to multipleZMQ.PUB
(publishers). No single publisher overwhelms the subscriber. The messages from both publishers are interleaved.
Usage:
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:
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)) or1
(i.e. StoneHouse) or2
(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(ifTrue
)/deactivate(ifFalse
) JPEG Frame Compression as well as to specify incoming frames colorspace with compression. By default colorspace isBGR
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 from10
to100
(the higher is the better quality but performance will be lower). Its default value is90
. 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 alsoTrue
. More information can be found here ➶ -
jpeg_compression_fastupsample
(bool): This internal attribute if True, use fastest color upsampling method. Its default value isFalse
. 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 than0
, and its default value is3
. -
request_timeout
(integer): This internal attribute controls the timeout value (in seconds), after which the Server/Client exit itself withNonetype
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 than0
, and its default value is10
seconds. -
subscriber_timeout
(integer): Similar torequest_timeout
, this internal attribute also controls the timeout value (in seconds) but for non-synchronouszmq.PUB/zmq.SUB
pattern in compression mode, after which the Client(Subscriber) exit itself withNonetype
value if it's unable to get any response from the socket. It's value can anything greater than0
, and its disabled by default (meaning the client will wait forever for response). -
flag
(integer): This PyZMQ attribute value can be either0
orzmq.NOBLOCK
( i.e. 1). More information can be found here ➶.
With flags=1 (i.e. NOBLOCK
), NetGear raises ZMQError
if no messages have arrived; otherwise, this waits until a message arrives.
-
copy
(boolean): This PyZMQ attribute selects if message be received in a copying or non-copying manner. IfFalse
a object is returned, ifTrue
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 ifcopy=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": True,
"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: