Can I convert string to memoryview?

Viewed 347

So I have 2 programs which I am connecting via UDP.

Sender:

self.v = memoryview(self.Data)
sock.sendto(self.v, (UDP_IP, UDP_PORT))

Receiver:

self.rcv, self.addr = sock.recvfrom(1024)

You can notice that what I am passing is a memoryview object and this is what I would like to receive. But it doesn't work that way. What I receive is a string which I'd like to convert back to memoryview. Is it possible?

self.Data is a bytearray

0 Answers
Related