Skip to content
Snippets Groups Projects
Commit 6943f43a authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-244: Don't go overly complex if we need a new buffer every time anyway....

L2SS-244: Don't go overly complex if we need a new buffer every time anyway. Just return a set of bytes for each packet.
parent aeee7d90
No related branches found
No related tags found
1 merge request!56L2SS-244: Expose the SSTs in MPs
......@@ -109,11 +109,10 @@ class UDP_Receiver(Thread):
This class provides a small wrapper for the OPC ua read/write functions in order to better organise the code
"""
def __init__(self, host, port, queue, buffersize=9000, timeout=0.1):
def __init__(self, host, port, queue, timeout=0.1):
self.queue = queue
self.host = host
self.port = port
self.buffersize = buffersize
logger.debug("binding a socket on UDP port {} and host {}".format(self.port, self.host))
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
......@@ -132,10 +131,8 @@ class UDP_Receiver(Thread):
while self.stream_on:
try:
packet = [bytearray(self.buffersize)]
self.sock.recvmsg_into(packet[0:self.buffersize])
packet, _, _, _ = self.sock.recvmsg()
self.queue.put(packet)
except socket.timeout:
pass
except queue.Full:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment