Jump to content

Which is better Python or java? For network programming, security and over all.


Devansh

Recommended Posts

That depends on what kind of "network programming".

 

From mine point of view of "network programming" it's using socket(), gethostbyname(), bind(), listen(), etc. etc.

and making your own server of some protocol, or client to some protocol, or both.

http://en.wikipedia.org/wiki/Berkeley_sockets

Either Java and Python are not good for this task IMHO. They demand speed, especially server side. The best for making servers/clients is C/C++.

 

Java is often used to make Internet games that doesn't demand speed (like chess, card games).

Client side of network is run on user web browser, and connects to server (which actually doesn't have to be Java).

Probably nobody would dare to write serious FPS for 40+ players in Java.

FPS are the most demanding examples of client-server network applications.

They require real-time transmission of data from client to server, and then server broadcasting all data to all players, and everything has to be done within miliseconds.

While playing Counter-Strike: Source in same country you have pings like 20 ms-50 ms.

 

Link to comment
Share on other sites

Python or Ruby work well for NP, security is in your code, so that depends on how you write things, and overall they are both excellent languages

 

also

 

 

They demand speed, especially server side.

How much speed? I can easily term 10k cps with a ruby server, maybe more if i wanted to get fancier with it, python would be no different, so how much performance are we talking? Speed-wise i would be done well before C/C++ even goes into debugging.

 

If you intend to do real network programming, with real performance, really emphasizing security, and uptime, Erlang is the tool for the job.

Link to comment
Share on other sites

How much speed? I can easily term 10k cps with a ruby server, maybe more if i wanted to get fancier with it, python would be no different, so how much performance are we talking? Speed-wise i would be done well before C/C++ even goes into debugging.

 

It's not the speed like you think.. If you receive or send one huge packet of data, most of cpu time is spend not in Python, but in operating system.

 

In Counter-Strike: Source each player is receiving maybe something like 5-6 kb of data per second.

So when 40 players play a game, server has to send 200-240 kb of data per second (and receive 40 kb from players). I think so it's compressed data, not raw. So server has to compress it and decompress (perhaps even 8000 times per second). Because there is really a lot to send *)

But it's not 200 kb of data in one packet! It's more likely 2000-4000 packets with 50-100 bytes each. With steady delays between them, like 10-20 miliseconds. It's not one thread receiving data, but more likely 40 threads, each one waiting for data from just single player. If it would be one thread, processing data of one player would influence receiving data from other players when client would send them in wrong moment while server is busy processing other player data.

 

We don't know details chosen by game developer to discuss it with detail. For example who calculates collisions: server or client? If client does it, then if some of them won't receive packet (lost packet) he will be alife, while other player will see him dead (?!) so it's strong argument for calculating this stuff on server side, and just broadcast info about death to clients (dead body remain in place, so it's broadcast even when it's not longer playing). The more will be done on client side of game, the more likely somebody will make cheat utilizing it. If client has to calculate final position of player after movement, cheat can change position of player twice as fast as usual f.e. or walking through walls (no collision checking), or flying (no gravity calculations).

 

*) for instance some player is throwing away weapon, it's flying in air, all other 40 players can see this weapon in air flying, and they can catch it while it's in air.. Otherwise it'll land on the ground, or reflect from walls or other people, and stay there for future.. Player can buy as much weapons as he/she wants (up to default money 16 k$) and throw it away. So if every player will do it, for all 16k$, with 1k$ price of each weapon, we will end up with something like 640 weapon items laying on the ground in whole playfield..

And there are other items like grenades that can be laying on the ground as well.

Edited by Sensei
Link to comment
Share on other sites

  • 3 years later...

How much more productive? The most widely accepted estimate is 5-10 times. On the basis of my own personal experience with the two languages, I agree with this estimate.

Managers who are considering adding Python to their organization’s list of approved development tools, however, cannot afford to accept such reports uncritically. They need evidence and some understanding of why programmers are making such claims. This page is for those managers.

On this page, I present a list of side-by-side comparisons of features of Java and Python. If you look at these comparisons, you can see why Python can be written much more quickly, and maintained much more easily, than Java. The list is not long — it is meant to be representative, not exhaustive.

This page looks only at programmer productivity and does not attempt to compare Java and Python on any other basis. There is, however, one related topic that is virtually impossible to avoid. Python is a dynamically-typed language, and this feature is an important reason why programmers can be more productive with Python; they don’t have to deal with the overhead of Java’s static typing. So the debates about Java/Python productivity inevitably turn into debates about the comparative advantages and drawbacks of static typing versus dynamic typing — or strong typing versus weak typing — in programming languages. I will not discuss that issue here, other than to note that in the last five years a number of influential voices in the programming community have been expressing serious doubts about the supposed advantages of static typing. I find this article commercial link removed by moderator where you can get a lot of useful information on this topic. I hope this helps. Good Luck

Edited by Phi for All
No advertising, please
Link to comment
Share on other sites

15 minutes ago, Klalero said:

How much more productive? The most widely accepted estimate is 5-10 times.

Citation needed. And this doesn't make sense: what is more productive than what?

17 minutes ago, Klalero said:

On this page, I present a list of side-by-side comparisons of features of Java and Python.

No you don't.

18 minutes ago, Klalero said:

I find this article

Ah. OK. Got it. Thanks. Reported as spam.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.