# Anyone used sockets to listen for python3 objects?

**URL:** https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231
**Category:** New to Julia
**Tags:** python, sockets
**Created:** [January 29, 2021, 9:38pm UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231 "2021-01-29T21:38:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)
#### Post date: [January 29, 2021, 9:38pm UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231/1 "2021-01-29T21:38:45Z")

</div>

Hi all  
just coded up a simple python script that posts to a socket ,every 5 seconds, a message containing the following objects.

integer  
unixdatetime  
float64  
string 20 bytes  
float64

writing a listener python program to “read” the data is easy but I haven’t really examined how julia would handle processing the python objects. I know there are many other ways to transfer information between python and julia but I’d like to play around with sockets. Anyone got experience with this please? ALL help gratefully accepted.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 29, 2021, 9:41pm UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231/2 "2021-01-29T21:41:56Z")

</div>

It would be easier to help you if you posted the Python socket-reader code you are trying to emulate in Julia, and post where you got stuck (e.g. were you at least able to connect to the socket in Julia?)

---

<div class="post-metadata">

### Author: ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)
#### Post date: [January 29, 2021, 9:55pm UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231/3 "2021-01-29T21:55:33Z")

</div>

hi there  
Sorry if the question wasn’t clear, that’s on me. Here is the same question but, hopefully, more considered.

Has anyone written a julia sockets program that can process packets sent by a python program? I understand that there should be no distinction between a python packet and one generated by anything else but I wonder if there are any gotchas.  
I have NOT written any julia code yet so this is a request for tips and tricks. Thank you

---

<div class="post-metadata">

### Author: ![Jeff\_Emanuel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff_emanuel/32/15440_2.png) [@Jeff\_Emanuel](https://discourse.julialang.org/u/Jeff_Emanuel)
#### Post date: [January 30, 2021, 12:41am UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231/4 "2021-01-30T00:41:05Z")

</div>

I expect you’ll have a better experience if you send the data in a language agnostic interchange format, such as XML or JSON. I don’t know, but I expect that Python pickles objects when writing them to a socket. Trying to decode another language’s specific binary persistence format in Julia is probably more trouble than it is worth if you can help it.

---

<div class="post-metadata">

### Author: ![anon69491625](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@anon69491625](https://discourse.julialang.org/u/anon69491625)
#### Post date: [January 30, 2021, 11:35am UTC](https://discourse.julialang.org/t/anyone-used-sockets-to-listen-for-python3-objects/54231/5 "2021-01-30T11:35:51Z")

</div>

Hi there  
thanks for the reply, great suggestion but I am trying to keep this as close to raw data as I can get. I’m just putting the basic message ( see below) out. I’ve loaded up a raspberry pi 3 (datapump) with the python code and thinking about using my first Julia code on another pi ( dataconsumer) to LISTEN to the output from datapump. I’m not going to pickle anything and trying to stay clear of xml. might mess around with soh etx etb type delimiters.  
integer  
unixdatetime  
float64  
string 20 bytes  
float64
