qrisp.quantum_network.QuantumNetworkClient.inbox#
- QuantumNetworkClient.inbox()[source]#
Returns a list of tuples containing the received qubits and their annotations.
- Returns
- res_listlist[tuple[list[Qubit], str]]
A list of tuples containing the sent qubits and the annotations.
Examples
We send a qubit from one client to another and inspect the inbox
>>> from qrisp.quantum_network import QuantumNetworkServer, QuantumNetworkClient >>> local_server = QuantumNetworkServer("127.0.0.1", background = True) >>> local_server.start() >>> alice_client = QuantumNetworkClient(name = "alice", socket_ip = "127.0.0.1") >>> bob_client = QuantumNetworkClient(name = "bob", socket_ip = "127.0.0.1")
Prepare the qubit which will be sent to bob:
>>> from qrisp import QuantumCircuit >>> qc = QuantumCircuit(1) >>> qc.h(0) >>> alice_client.run(qc) {'': 1}
Send the qubit to Bob:
>>> alice_client.send_qubits("bob", [qc.qubits[0]], annotation = "Merry christmas!")
Now Bob can check his inbox
>>> messages = bob_client.inbox() >>> received_qubits, annotation = messages[0] >>> print(received_qubits) [Qubit(qb_20@alice)] >>> print(annotation) Merry christmas!