Need Help - Is Python Networking a Good Idea?

I am considering programming the network-related features of my application in Python instead of the C / C ++ API. The intended use of networks is the transmission of text messages between two instances of my application, similar to how a game plays in the player’s position as often as possible over the network.

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

What do you think of the python socket module:

  • Is it reliable and fast enough for software to ensure product quality?
  • Are there any known limitations that could be a problem if my application. need a more complex network than normal messaging with the client and server?

Thanks in advance,

Floor

+4
source share
4 answers

Take a look at Twisted , the Python engine for networking. It 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).

+9
source

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

You will find that in a short time you can write beautiful code so that this code is read from the very beginning and that it remains readable (you will still know what it does, even after returning a year later).

The downside of Python is that your code will be somewhat slow. "Multiple," as in "may be too slow for certain occasions." So the usual approach is to write as much as possible in Python, because it will make your application convenient. In the end, you may run into speed issues. It’s time to consider rewriting part of your application in C.

The main advantages of this approach are:

  • You already have a working application. Translating code from Python to C is much easier than writing from scratch.
  • You already have a working application. After translating a small part of Python to C, you just need to check out this small part, and you can use the rest of the application (which has not changed) to do this.
  • You do not pay the price in advance. If Python is fast enough for you, you will never have to perform additional optimizations.
  • Python is much, much more powerful than C. Each Python line can do the same as 100 or even 1000 C lines.
+3
source

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

+1
source

Pete, who uses EVE on the network, is StacklessPython ( http://www.stackless.com/ ), and as I understand it, they use it for how it implements threading using talismans and much more. But since python itself can handle things like MMOs with 40k people on the Internet, I think it can do something.

This poor answer and not quite the answer to your question, rather, is an addition to the previous answer.

Alan.

+1
source

All Articles