Data Queue is a particular kind of abstract data type or collection. This makes the queue a First-in-First-Out (FIFO) data structure.
python queue socket example
MCAST_ADDR1 = '10.0.0.1';MCAST_PORT1 = 1;
MCAST_ADDR2 = '10.0.0.2';MCAST_PORT2 = 1;
try:
sock.bind((MCAST_ADDR1, MCAST_PORT1))
except socket.error as e:
print('[ERROR] Cannot bind address: ', HOST, e)
s = struct.pack("=4sl", socket.inet_aton(MCAST_ADDR2), socket.INADDR_ANY)
status=sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, s)
data= sock.recv(1024)
packetQueue.put(data)
沒有留言:
張貼留言