tags:

views:

484

answers:

6

I'd like to develop software program that communicates between clients. What is the best programming language to do this?

+13  A: 

The language that you know that best and can handle sockets. Network programming is not better on one language verses another. As long as the language can effectively handle the data that is being received and can format the data that is going it out, it is an acceptable candidate.

The whole point of networking is to bridge non-uniform machines.

monksy
Man, I was going to say EXACTLY that. Same words and all.
Paul Tomblin
What are the most popular languages that can do that?
xpda
That said, programming sockets in a raw-memory language such as C may be more error-prone. A managed language such as Java, C# or Python will be less prone to buffer overruns, may be able to provide more help with byte ordering, etc.
itowlson
@xpda: Any of them with a standard library or module that exposes sockets. Off the top of my head: Ruby, Python, Perl, Java, C, C++, Ada, Delphi, Fortran, Haskell, Erlang, Scheme, Scala, TCL, D, Forth, Go, Pascal, .... Need I go on?
greyfade
Depends on the developer's strength with the language. I agree with you, however it depends on the requirements for the program.
monksy
Now that there is Node.js, JavaScript. http://nodejs.org/
Nosredna
Wow..I am impressed.
monksy
A great article on why Node is revolutionary: http://simonwillison.net/2009/Nov/23/node/
Nosredna
+2  A: 

There is no one best language for this, just like for almost anything else.

Use a language that you know and can do sockets. There are a lot of them.

I usually use Perl or C. Perl is helpful because it helps manage memory for you, process strings (common for network code) and prevent buffer overflows. But really I used it because I know it already.

Use what you know.

Don't forget to do your communications in network byte order. If you don't, you'll likely be sorry later.

Southern Hospitality
+3  A: 

The language you are writing the client software with, if it's adequate, and almost any client language would be. Keep things simple.

le dorfier
It does, but it is not necessary. Also it depends on the problem domain.
monksy
+1  A: 

For the topics you described, you need to understand operating systems more than any specific language. Once the OS level becomes clear, the code is quite obvious in any decent language (although, Python is great for that).

This is one of the best books ever written:

Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series) (Paperback)

ISBN-10: 0321525949
ISBN-13: 978-0321525949

5 star amazon reviews (I'd give it 6).

Once I realized that networking, file I/O, shared memory, IPC, sockets, signals, etc... are all provided by the OS layer, then this became the answer to a lot of questions.

Then going back to language X (or Python), you understand what all the stuff in the os module means, and can write really advanced programs with ease.

gahooa
This is completely offtopic.
monksy
Completely disagree with you steven. Can you explain?
gahooa
+1  A: 

If you already know some Python (which I'm assuming you do, as the question is tagged with Python), then I'd really recommend taking a look at Python's Twisted library.

Twisted is an asynchronous comms library that does all of the hard work for you - so you don't have to get involved with the underlying sockets library. Twisted can be a little tricky to get used to initially, but very quickly you'll be writing some very effective code to handle both clients and servers.

Jon Mills
Twisted (and Ruby's Event Machine) are very impressive. Node.js surpasses them both in the sense that there are NO blocking calls.
Nosredna
+2  A: 

All languages have some sort of libraries for network programming, usually Sockets (anyone here remember TLI/XTI?). Sockets originally is C API so sockets implementation in other languages can be limited.

Example: colleague of mine, who is Java programmed, asked me for advice on using TCP keepalive. I told him to use SO_KEEPIDLE option and then he discovered that Java socket API doesn't have it - you can only switch keepalive on but you have no control on the keepalive frequency. There are probably some other bits and pieces missing in Java Socket API. Don't know about other languages but my guess is there are some omissions as well.

So if you are proficient in C, grab Stevens' UNP Volume 1 (not APUE, as other poster suggested - APUE is good, but UNP1 serves your purpose better) and code everything in C.

qrdl