views:

197

answers:

4

Hello,

I am considering programming the network related features of my application in Python instead of the C/C++ API. The intended use of networking is to pass text messages between two instances of my application, similar to a game passing player positions as often as possible over the network.

Although the python socket modules seems sufficient and mature, I want to check if there are limitations of the python module which can be a problem at a later stage of the development.

What do you think of the python socket module :

  1. Is it reliable and fast enough for production quality software ?
  2. Are there any known limitations which can be a problem if my app. needs more complex networking other than regular client-server messaging ?

Thanks in advance,

Paul

A: 

To answer #1, I know that among other things, EVE Online (the MMO) uses a variant of Python for their server code.

Amber
*Eve uses Stackless Python.
Kevin
A: 

The python that EVE online uses is StacklessPython (http://www.stackless.com/), and as far as i understand they use it for how it implements threading through using tasklets and whatnot. But since python itself can handle stuff like MMO with 40k people online i think it can do anything.

This bad answer and not really an answer to your question, rather addition to previous answer.

Alan.

Zayatzz
+1  A: 

Python is a mature language that can do almost anything that you can do in C/C++ (even direct memory access if you really want to hurt yourself).

You'll find that you can write beautiful code in it in a very short time, that this code is readable from the start and that it will stay readable (you will still know what it does even after returning one year later).

The drawback of Python is that your code will be somewhat slow. "Somewhat" as in "might be too slow for certain cases". So the usual approach is to write as much as possible in Python because it will make your app maintainable. Eventually, you might run into speed issues. That would be the time to consider to rewrite a part of your app in C.

The main advantages of this approach are:

  1. You already have a running application. Translating the code from Python to C is much more simple than write it from scratch.
  2. You already have a running application. After the translation of a small part of Python to C, you just have to test that small part and you can use the rest of the app (that didn't change) to do it.
  3. You don't pay a price upfront. If Python is fast enough for you, you'll never have to do the optional optimization.
  4. Python is much, much more powerful than C. Every line of Python can do the same as 100 or even 1000 lines of C.
Aaron Digulla
+8  A: 

Check out Twisted, a Python engine for Networking. Has built-in support for TCP, UDP, SSL/TLS, multicast, Unix sockets, a large number of protocols (including HTTP, NNTP, IMAP, SSH, IRC, FTP, and others)

Yancy