You are not logged in.

#1 2005-06-13 10:23:28

sweiss
Member
Registered: 2004-02-16
Posts: 635

Unix Domain Sockets in Python

Hello (again).
I'm looking for some information regarding usage of unix domain sockets (or file sockets) via Python. I've googled for ages but I can't find any example.

Can anyone please give me a quick overview?

Thanks again.

Offline

#2 2005-06-13 10:32:13

cmp
Member
Registered: 2005-01-03
Posts: 350

Re: Unix Domain Sockets in Python

it isn't that hard, but the documentation on the python page is a bit wired (no explanation of returns types, etc.)
but did you have a look at this page?

Offline

#3 2005-06-13 10:38:11

sweiss
Member
Registered: 2004-02-16
Posts: 635

Re: Unix Domain Sockets in Python

I have, but it doesn't relate to file sockets. I don't quite know how am I supposed to work with those, how to create them, how to write to them or how to read from them.

Can you please explain these?

Thanks.

Offline

#4 2005-06-13 16:26:51

cactus
Taco Eater
From: t͈̫̹ͨa͖͕͎̱͈ͨ͆ć̥̖̝o̫̫̼s͈̭̱̞͍̃!̰
Registered: 2004-05-25
Posts: 4,615
Website

Re: Unix Domain Sockets in Python

do you need a file socket, or could you get by with a pipe?


"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍

Offline

#5 2005-06-13 17:58:35

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Unix Domain Sockets in Python

Man, I wrote this post then the network went down at work... and couldn't post it... skipping all the examples I had:

do what the article has *exactly* but change "AF_INET" to "AF_UNIX" - done...

you should really delve into BSD style sockets if you want to do unix-socket based IPC...

also, python is generally portable.  Unix domain sockets are not.  The article points to using TCP sockets for IPC, which is a good idea with python because *everything* supports TCP sockets

Offline

#6 2005-06-13 19:12:31

sweiss
Member
Registered: 2004-02-16
Posts: 635

Re: Unix Domain Sockets in Python

The application I'm working on is an updater for Arch, so portability is not an issue smile

I guess I'll use TCP sockets then after all.

Offline

Board footer

Powered by FluxBB