开发者

python intra pc client-server - dbus alternative?

I need to estabilish client-server communications on a single pc (no network) and the only option I found so far is to use dbus.

The problem is that python-dbus seems to work bad on wondows so far (my app is cross platform), furthermore I read that python-dbus api continues 开发者_如何学Goto change breaking code.

Is there an alternative to this, preferably using the python standard library?

I was considering the use of sockets and loopback 127.0.0.1 but this way I have to use a port risking another app is already using that port.


I think that use a socket is the best way to do that. You can use the port you want.

If you want to reduce the risk of port conflict, just put the port into a config file and load it to the start of the software.

You can also use a parameter when you call your software like (the best solution in my opinion) :

./my_soft -p 8584

Of course, 8584 is an example. To do that easily, my advice is to use the argparse library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜