added bsread host

This commit is contained in:
2025-10-18 19:01:10 +02:00
parent 571b2749f2
commit a836039bab
2 changed files with 8 additions and 6 deletions

View File

@@ -12,24 +12,25 @@ def main():
parser.add_argument("--accumulator_host", default="*")
parser.add_argument("--accumulator_port", type=int, default=13000)
parser.add_argument("--bsread_port", type=int, default=None) #TODO: is the host needed?
parser.add_argument("--bsread_host", default="*")
parser.add_argument("--bsread_port", type=int, default=None)
clargs = parser.parse_args()
accumulator_addr = make_address(clargs.accumulator_host, clargs.accumulator_port)
accumulate(accumulator_addr, clargs.bsread_port)
accumulate(accumulator_addr, clargs.bsread_host, clargs.bsread_port)
def accumulate(accumulator_addr, bsread_port):
def accumulate(accumulator_addr, bsread_host, bsread_port):
zmq_socks = ZMQSocketsAccumulator(accumulator_addr)
output = FileHandler()
sorter = Sorter()
sender = make_bsread_sender(bsread_port)
sender = make_bsread_sender(bsread_host, bsread_port)
while True:
if not zmq_socks.has_data():

View File

@@ -1,10 +1,11 @@
from bsread.sender import Sender, PUB
def make_bsread_sender(bsread_port):
def make_bsread_sender(bsread_host="*", bsread_port=None):
if not bsread_port:
return None
sender = Sender(port=bsread_port, block=False, mode=PUB)
address = f"tcp://{bsread_host}"
sender = Sender(address=address, port=bsread_port, block=False, mode=PUB)
sender.open()
return sender