Network

class Network(self)

Bases: pybind11_object

This class represents a Transmission Control Protocol (TCP) network.

TCP provides reliable, ordered delivery of a stream of bytes from a program on one computer to another program on another computer.

Warning

This class shouldn’t be used directly. You better use vpClient and vpServer to simulate your network. Some examples are provided in these classes.

Note

See vpServer

Note

See vpNetwork

Methods

__init__

getMaxSizeReceivedMessage

Get the maximum size that the emitter can receive (in request mode).

getReceptorIndex

Get the receptor index from its name.

getRequestIdFromIndex

Get the Id of the request at the index ind.

print

Print the receptors.

receiveAndDecodeRequest

Receives and decode requests until there is requests to receive.

receiveAndDecodeRequestFrom

Receives and decode requests, from a specific emitter, until there is request to receive.

receiveAndDecodeRequestOnce

Receives a message once (in the limit of the Maximum message size value).

receiveAndDecodeRequestOnceFrom

Receives a message once (in the limit of the Maximum message size value), from a specific emitter.

receiveRequest

Receive requests until there is requests to receive.

receiveRequestFrom

Receives requests, from a specific emitter, until there is request to receive.

receiveRequestOnce

Receives a message once (in the limit of the Maximum message size value).

receiveRequestOnceFrom

Receives a message once (in the limit of the Maximum message size value), from a specific emitter.

removeDecodingRequest

Delete a decoding request from the emitter.

sendAndEncodeRequest

Send and encode a request to the first receptor in the list.

sendAndEncodeRequestTo

Send and encode a request to a specific receptor.

sendRequest

Send a request to the first receptor in the list.

sendRequestTo

Send a request to a specific receptor.

setMaxSizeReceivedMessage

Change the maximum size that the emitter can receive (in request mode).

setTimeoutSec

Change the time the emitter spend to check if he receives a message from a receptor.

setTimeoutUSec

Change the time the emitter spend to check if he receives a message from a receptor.

setVerbose

Set the verbose mode.

Inherited Methods

Operators

__annotations__

__doc__

__init__

__module__

Attributes

__annotations__

__init__(self)
getMaxSizeReceivedMessage(self) int

Get the maximum size that the emitter can receive (in request mode).

Returns:

Acutal max size value.

getReceptorIndex(self, name: str) int

Get the receptor index from its name. The name can be either the IP, or its name on the network.

Parameters:
name: str

Name of the receptor.

Returns:

Index of the receptor, or -1 if an error occurs.

getRequestIdFromIndex(self, ind: int) str

Get the Id of the request at the index ind.

Parameters:
ind: int

Index of the request.

Returns:

Id of the request.

print(self: visp._visp.core.Network, id: str =) None

Print the receptors.

Parameters:
id

Message to display before the receptor’s index.

receiveAndDecodeRequest(self) list[int]

Receives and decode requests until there is requests to receive.

Warning

Requests will be received but not decoded.

Note

See vpNetwork::receive()

Note

See vpNetwork::receiveRequestFrom()

Note

See vpNetwork::receiveRequestOnce()

Note

See vpNetwork::receiveRequestOnceFrom()

Note

See vpNetwork::receiveAndDecodeRequest()

Note

See vpNetwork::receiveAndDecodeRequestFrom()

Note

See vpNetwork::receiveAndDecodeRequestOnce()

Note

See vpNetwork::receiveAndDecodeRequestOnceFrom()

receiveAndDecodeRequestFrom(self, receptorEmitting: int) list[int]

Receives and decode requests, from a specific emitter, until there is request to receive.

Warning

Requests will be received but not decoded.

Note

See vpNetwork::receive()

Note

See vpNetwork::receiveRequest()

Note

See vpNetwork::receiveRequestOnce()

Note

See vpNetwork::receiveRequestOnceFrom()

Note

See vpNetwork::receiveAndDecodeRequest()

Note

See vpNetwork::receiveAndDecodeRequestFrom()

Note

See vpNetwork::receiveAndDecodeRequestOnce()

Note

See vpNetwork::receiveAndDecodeRequestOnceFrom()

Parameters:
receptorEmitting: int

Index of the receptor emitting the message

receiveAndDecodeRequestOnce(self) int

Receives a message once (in the limit of the Maximum message size value). This message can represent an entire request or not. Several calls to this function might be necessary to get the entire request. If it represents an entire request, it decodes the request.

Returns:

The number of bytes received, -1 if an error occured.

receiveAndDecodeRequestOnceFrom(self, receptorEmitting: int) int

Receives a message once (in the limit of the Maximum message size value), from a specific emitter. This message can represent an entire request or not. Several calls to this function might be necessary to get the entire request. If it represents an entire request, it decodes the request.

Parameters:
receptorEmitting: int

Index of the receptor emitting the message.

Returns:

The number of bytes received, -1 if an error occured.

receiveRequest(self) list[int]

Receive requests until there is requests to receive.

Warning

Requests will be received but not decoded.

Note

See vpNetwork::receive()

Note

See vpNetwork::receiveRequestFrom()

Note

See vpNetwork::receiveRequestOnce()

Note

See vpNetwork::receiveRequestOnceFrom()

Note

See vpNetwork::receiveAndDecodeRequest()

Note

See vpNetwork::receiveAndDecodeRequestFrom()

Note

See vpNetwork::receiveAndDecodeRequestOnce()

Note

See vpNetwork::receiveAndDecodeRequestOnceFrom()

receiveRequestFrom(self, receptorEmitting: int) list[int]

Receives requests, from a specific emitter, until there is request to receive.

Warning

Requests will be received but not decoded.

Note

See vpNetwork::receive()

Note

See vpNetwork::receiveRequest()

Note

See vpNetwork::receiveRequestOnce()

Note

See vpNetwork::receiveRequestOnceFrom()

Note

See vpNetwork::receiveAndDecodeRequest()

Note

See vpNetwork::receiveAndDecodeRequestFrom()

Note

See vpNetwork::receiveAndDecodeRequestOnce()

Note

See vpNetwork::receiveAndDecodeRequestOnceFrom()

Parameters:
receptorEmitting: int

Index of the receptor emitting the message

receiveRequestOnce(self) int

Receives a message once (in the limit of the Maximum message size value). This message can represent an entire request or not. Several calls to this function might be necessary to get the entire request.

Returns:

The number of bytes received, -1 if an error occured.

receiveRequestOnceFrom(self, receptorEmitting: int) int

Receives a message once (in the limit of the Maximum message size value), from a specific emitter. This message can represent an entire request or not. Several calls to this function might be necessary to get the entire request.

Parameters:
receptorEmitting: int

Index of the receptor emitting the message.

Returns:

The number of bytes received, -1 if an error occured.

removeDecodingRequest(self, arg0: str) None

Delete a decoding request from the emitter.

Note

See vpNetwork::addDecodingRequest()

sendAndEncodeRequest(self, req: visp._visp.core.Request) int

Send and encode a request to the first receptor in the list.

Parameters:
req: visp._visp.core.Request

Request to send.

Returns:

The number of bytes that have been sent, -1 if an error occured.

sendAndEncodeRequestTo(self, req: visp._visp.core.Request, dest: int) int

Send and encode a request to a specific receptor.

Parameters:
req: visp._visp.core.Request

Request to send.

dest: int

Index of the receptor receiving the request.

Returns:

The number of bytes that have been sent, -1 if an error occured.

sendRequest(self, req: visp._visp.core.Request) int

Send a request to the first receptor in the list.

Parameters:
req: visp._visp.core.Request

Request to send.

Returns:

The number of bytes that have been sent, -1 if an error occured.

sendRequestTo(self, req: visp._visp.core.Request, dest: int) int

Send a request to a specific receptor.

Parameters:
req: visp._visp.core.Request

Request to send.

dest: int

Index of the receptor receiving the request.

Returns:

The number of bytes that have been sent, -1 if an error occured.

setMaxSizeReceivedMessage(self, s: int) None

Change the maximum size that the emitter can receive (in request mode).

Note

See vpNetwork::getMaxSizeReceivedMessage()

Parameters:
s: int

new maximum size value.

setTimeoutSec(self, sec: int) None

Change the time the emitter spend to check if he receives a message from a receptor. Initially this value is set to 10usec.

Note

See vpNetwork::setTimeoutUSec()

Parameters:
sec: int

new value in second.

setTimeoutUSec(self, usec: int) None

Change the time the emitter spend to check if he receives a message from a receptor. Initially this value is set to 10usec.

Note

See vpNetwork::setTimeoutSec()

Parameters:
usec: int

new value in micro second.

setVerbose(self, mode: bool) None

Set the verbose mode.

Parameters:
mode: bool

Change the verbose mode. True to turn on, False to turn off.