Like Tree1Likes
  • 1 Post By Elkvis

Is C still a great networking language?

This is a discussion on Is C still a great networking language? within the C Programming forums, part of the General Programming Boards category; I have been working on an internet game for my practicum and I finished the client in C#, however I ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    4

    Is C still a great networking language?

    I have been working on an internet game for my practicum and I finished the client in C#, however I am wondering if I should do the server in C like I was planning until now. I am not afraid of either language, and in fact I have mountains of experience with C network programming.

    However, reading articles today make it sound like C# can actually beat out C in speed? The articles all seem back and forth on the matter, one concluding that C# can beat C in some aspects, others concluding that if you are good, then C definitely wins. My question is, should I just make the server-side of my multiplayer game in C# then?

    My main concern in this game is the network code. I want to have as many connections as possible and be able to send really compact data between my client and my server. There's also a large validation step in my programming. I will probably have to run through a lot of double for loops to check that everything the client submitted is valid.

    edit

    it just came to me that those comments about C# shouldn't apply in my case because I am making a server which I can compile on the machine, so C#'s JIT compiler won't make any difference optimization wise. Am I right in this conclusion?
    Last edited by DarkD; 08-11-2014 at 04:02 AM.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,290
    If you have mountains of experience with C network programming, as you claim, why couldn't you reason out an answer for yourself?

    In terms of basic networking (sockets, etc) I'd suggest there is little advantage one way or the other between C and C# - in the end the library functions are essentially equivalent. If you're using higher level constructs (say, a networking framework) then, again, it depends on what techniques you're using. The language doesn't matter so much in those cases - it's the quality of libraries and library features you access using those languages.

    The difference between C and C# will mostly come down to how the program implements its working logic (how data is produced for sending, or how data is processed on receipt). And then you run into the fact that C will be more efficient for some tasks or programming techniques or language features, while C# is more efficient for others. In other words, both C and C# have their advantages over the other, depending on what you do with them.


    There is a limitation, practically, that C# is more likely to limit your program to Microsoft operating systems. If you're happy for both client and server to be locked to Microsoft platforms, C# is fine. If you care more about portability, C is probably preferable.
    Right 98% of the time, and don't care about the other 3%.

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    4
    When I say I have mountains of C experience, I mean that my diploma major was pretty much exclusively C/C++ programming, and the C++ parts I just did in C because I don't like working with objects. C# I just picked up and made the client with it. Doesn't seem hard and the only part of C# I was really afraid of was the GUI part which I'm done with.

    However what about the fact that it's server-side code? The comments I read about C# stated that it's advantages came from the JIT compiler which would optimize the code for each computer it was put on, however I only intend on having the server on one computer which I intend to compile on with full optimizations.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,407
    Quote Originally Posted by grumpy View Post
    There is a limitation, practically, that C# is more likely to limit your program to Microsoft operating systems. If you're happy for both client and server to be locked to Microsoft platforms, C# is fine. If you care more about portability, C is probably preferable.
    While C reigns supreme as the language of choice if portability is your goal, Mono makes C# available on many platforms, including Linux, *BSD, Solaris, MacOS, and others.

    Quote Originally Posted by DarkD View Post
    When I say I have mountains of C experience, I mean that my diploma major was pretty much exclusively C/C++ programming, and the C++ parts I just did in C because I don't like working with objects.
    If you don't like working with objects, I find it a bit strange that you're using C#.

    Quote Originally Posted by DarkD View Post
    However what about the fact that it's server-side code? The comments I read about C# stated that it's advantages came from the JIT compiler which would optimize the code for each computer it was put on, however I only intend on having the server on one computer which I intend to compile on with full optimizations.
    One thing that C# makes very easy is multi-threaded network code. Asynchronous operations are really easy to accomplish, and you get the advantage that the .Net/Mono runtime manages everything for you. It's not necessary to call poll() or select(). You just start an asynchronous operation with BeginReceive() or BeginSend() with a callback, and it sets everything up on the back end for you, and calls your callback when the operation is ready to complete. There are certainly disadvantages to this, but it certainly does make it easier to write the network code.
    stahta01 likes this.
    Code:
    namespace life
    {
        const bool change = true;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Is C++ or C language is a high Level language?
    By uthmankhale in forum C++ Programming
    Replies: 5
    Last Post: 08-25-2011, 06:00 PM
  2. What's the Difference Between a Programming Language and a Scripting Language?
    By Krak in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 07-15-2005, 04:46 PM
  3. What's so great about C++?
    By InFeStEd-ArCh0n in forum C++ Programming
    Replies: 32
    Last Post: 05-07-2002, 09:49 PM
  4. Computer Language VS Spoken Language
    By Isometric in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 02-04-2002, 02:47 PM
  5. What is so great with .NET?
    By Fool in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 09-04-2001, 01:02 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21