Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to send an array over a socket in python

I have an array kind of ([1,2,3,4,5,6],[1,2,3,4,5,6]) this. I have to send it over a STREAM/TCP socket in python. Then I have to receive the same array at the receiving end.

like image 569
sg.dev Avatar asked Jun 26 '14 05:06

sg.dev


People also ask

What is the use of socket Recvfrom () method in python?

The recvfrom() method can be used with an UDP server to receive data from a UDP client or it can be used with an UDP client to receive data from a UDP server.

Can a socket send and receive at the same time Python?

You can send and receive on the same socket at the same time (via multiple threads). But the send and receive may not actually occur simultaneously, since one operation may block the other from starting until it's done.


Video Answer


1 Answers

You can Serialize the object before sending to socket and at receiving end Deserialize it. Check this

like image 60
hashbrown Avatar answered Sep 22 '22 22:09

hashbrown