Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Re: High-level network programming: is C language suitable for that? (http://www.velocityreviews.com/forums/t945755-re-high-level-network-programming-is-c-language-suitable-for-that.html)

Jens Thoms Toerring 04-26-2012 07:54 PM

Re: High-level network programming: is C language suitable for that?
 
pozz <pozzugno@gmail.com> wrote:
> I'll start a new application in a short time and I'm wondering if C
> language is good enough for that.


> The application will be simple: it should implement some TCP/UDP
> protocols (like TFTP, BOOTP,...) with a simple GUI. It will run on
> Windows platforms, but the possibility to run it on Linux would be nice.


> Is C language suitable for this kind of applications? Which kind of
> cross-platform libraries should I use to manage IP protocols and simple
> GUIs? Could python or other high-level (script) languages be a better
> choice?


Of course, all this can be done in C (most scripting languages
are actually implemented in C, so everything you can do in
those languages can obviously be done in C). But note that C
has no "native" support for networking or graphics, thus the
need for additional (cross-platform) libraries (unless you're
keen to re-invent the wheel;-). For TFTP and other protocols
libcurl seems to be a candidate to take a look at. I don't
know about BOOTP (wasn't that obsoleted by DHCP?). For gra-
phics the only cross-platform library for C I know about is
GTK+ (but I never used it) - most other seem to require C++.

If using Python or some other scripting language would be pre-
ferable depends on what you want to do there, if you need max-
imum performance, and if you feel comfortable with that lan-
guage. Perhaps it might be a good idea to start with a scrip-
ting language and see if it does ok, otherwise you can still
re-implement the stuff in C, drawing on the experiences you
made.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

BartC 04-27-2012 09:02 AM

Re: High-level network programming: is C language suitable for that?
 


"Jens Thoms Toerring" <jt@toerring.de> wrote in message
news:9vtng0Fs7gU1@mid.uni-berlin.de...
> pozz <pozzugno@gmail.com> wrote:
>> I'll start a new application in a short time and I'm wondering if C
>> language is good enough for that.


> Of course, all this can be done in C (most scripting languages
> are actually implemented in C, so everything you can do in
> those languages can obviously be done in C).


By that argument, it can all be done in machine code or assembler too.

C *can* program just about anything, but it can be a lot easier and less
error-prone to just use a higher-level, more adept language.

--
Bartc

pozzugno@gmail.com 04-27-2012 09:20 AM

Re: High-level network programming: is C language suitable for that?
 
Il giorno gioved์ 26 aprile 2012 21:54:40 UTC+2, Jens Thoms Toerring ha scritto:
> pozz
> wrote:
> > I'll start a new application in a short time and I'm wondering if C
> > language is good enough for that.

>
> > The application will be simple: it should implement some TCP/UDP
> > protocols (like TFTP, BOOTP,...) with a simple GUI. It will run on
> > Windows platforms, but the possibility to run it on Linux would be nice..

>
> > Is C language suitable for this kind of applications? Which kind of
> > cross-platform libraries should I use to manage IP protocols and simple
> > GUIs? Could python or other high-level (script) languages be a better
> > choice?

>
> Of course, all this can be done in C (most scripting languages
> are actually implemented in C, so everything you can do in
> those languages can obviously be done in C).


Oh, yes. I know C is powerful enough to manage comple network
protocols and beautiful graphical interfaces. The questions was
related to a simple application where I don't want to loose
too much time to find a suitable network and graphic library and
fine tune them. C can do anything at the cost of greater complexity.

I'm asking if a high-level scripting language can be more effective
for simple tasks and applications.


> But note that C
> has no "native" support for networking or graphics, thus the
> need for additional (cross-platform) libraries (unless you're
> keen to re-invent the wheel;-).


Absolutely no, I want to reuse existing libraries.


> For TFTP and other protocols
> libcurl seems to be a candidate to take a look at. I don't
> know about BOOTP (wasn't that obsoleted by DHCP?).


I have to implement a sub-set of DHCP protocol, similar to the
original BOOTP. It's for an Ethernet firmware upgrade for
and embedded gadget.


> For gra-
> phics the only cross-platform library for C I know about is
> GTK+ (but I never used it) - most other seem to require C++.
>
> If using Python or some other scripting language would be pre-
> ferable depends on what you want to do there, if you need max-
> imum performance, and if you feel comfortable with that lan-
> guage. Perhaps it might be a good idea to start with a scrip-
> ting language and see if it does ok, otherwise you can still
> re-implement the stuff in C, drawing on the experiences you
> made.


Ok, thank you for your suggestions.

nick_keighley_nospam@hotmail.com 04-27-2012 02:27 PM

Re: High-level network programming: is C language suitable for that?
 
On Thursday, April 26, 2012 8:54:40 PM UTC+1, Jens Thoms Toerring wrote:
> pozz wrote:


> > I'll start a new application in a short time and I'm wondering if C
> > language is good enough for that.


C's pretty much "good enough" for anything. Could you produce your application quicker using some other language? Maybe.

> > The application will be simple: it should implement some TCP/UDP
> > protocols (like TFTP, BOOTP,...) with a simple GUI. It will run on
> > Windows platforms, but the possibility to run it on Linux would be nice..

>
> > Is C language suitable for this kind of applications? Which kind of
> > cross-platform libraries should I use to manage IP protocols and simple
> > GUIs? Could python or other high-level (script) languages be a better
> > choice?


python is certainly worth a look. It comes "out of the box" with socket andGUI libraries. It'll also run on multiple platforms, probably without change. Python can be a bit slow (which may not matter).

> Of course, all this can be done in C (most scripting languages
> are actually implemented in C, so everything you can do in
> those languages can obviously be done in C).


this is a theoretically true but practically useless.

*All* real-world programming languages are "turing complete". Which (loosly) means if it can be programmed then it can be programmed in that language.We could implement python in COBOL (if we enjoyed kicking dead whales downbeaches) but it wouldn't be fun.

> But note that C
> has no "native" support for networking or graphics, thus the
> need for additional (cross-platform) libraries (unless you're
> keen to re-invent the wheel;-). For TFTP and other protocols
> libcurl seems to be a candidate to take a look at. I don't
> know about BOOTP (wasn't that obsoleted by DHCP?). For gra-
> phics the only cross-platform library for C I know about is
> GTK+ (but I never used it) - most other seem to require C++.


openGL, Qt

> If using Python or some other scripting language would be pre-
> ferable depends on what you want to do there, if you need max-
> imum performance, and if you feel comfortable with that lan-
> guage. Perhaps it might be a good idea to start with a scrip-
> ting language and see if it does ok, otherwise you can still
> re-implement the stuff in C, drawing on the experiences you
> made.


yes that is a good idea. You may get something working much quicker in Python.

Jens Thoms Toerring 04-27-2012 05:07 PM

Re: High-level network programming: is C language suitable for that?
 
nick_keighley_nospam@hotmail.com wrote:
> On Thursday, April 26, 2012 8:54:40 PM UTC+1, Jens Thoms Toerring wrote:
> > Of course, all this can be done in C (most scripting languages
> > are actually implemented in C, so everything you can do in
> > those languages can obviously be done in C).


> this is a theoretically true but practically useless.


Well, the OP was asking "if C language is good enough for that";-)

> > But note that C
> > has no "native" support for networking or graphics, thus the
> > need for additional (cross-platform) libraries (unless you're
> > keen to re-invent the wheel;-). For TFTP and other protocols
> > libcurl seems to be a candidate to take a look at. I don't
> > know about BOOTP (wasn't that obsoleted by DHCP?). For gra-
> > phics the only cross-platform library for C I know about is
> > GTK+ (but I never used it) - most other seem to require C++.


> openGL, Qt


I fear using OpenGL for a simple GUI might not be too
suitable since it's a rendering library and what you
want for most simple GUIs is a set of widgets you can
easily manipulate, which isn't what OpenGL meant for
if I didn't mis-understand its purpose. Qt is defini-
tely C++ and I guess it could be a real pain if one
would try to marry it to a C program...

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

Rui Maciel 04-27-2012 06:16 PM

Re: High-level network programming: is C language suitable for that?
 
Jens Thoms Toerring wrote:

> But note that C
> has no "native" support for networking or graphics, thus the
> need for additional (cross-platform) libraries (unless you're
> keen to re-invent the wheel;-).


That depends on what's your definition of "native" support. There is a
considerable number of graphics and networking libraries which provide a C
API and are extensively used. For example, OpenGL, POSIX sockets and GTK
come to mind.


Rui Maciel

Jens Thoms Toerring 04-27-2012 10:37 PM

Re: High-level network programming: is C language suitable for that?
 
Rui Maciel <rui.maciel@gmail.com> wrote:
> Jens Thoms Toerring wrote:
> > But note that C
> > has no "native" support for networking or graphics, thus the
> > need for additional (cross-platform) libraries (unless you're
> > keen to re-invent the wheel;-).


> That depends on what's your definition of "native" support.


I would consider to be "native support" everything that comes
with the C standard library. Everything else is, at least for
me, optional - it might exist but doesn't have to. In other
languages (Java, Python) this is part of the core language
(if that was a brilliant idea will be clearer in let's say
20 years from now;-).

> There is a considerable number of graphics and networking libraries
> which provide a C API and are extensively used. For example, OpenGL,
> POSIX sockets and GTK come to mind.


That's just what, in the rest of my post, I thought I had
mentioned;-) Though I wouldn't consider OpenGL to be a GUI
library ("simple GUI" doesn't evoke the association of "fast
3D rendering" for me but more "a few buttons and maybe a few
other useful widgets"). And I don't know, not being a Windows
programmer, how far the POSIX socket API is supported under
Windows, the OPs primary target - and my impression was any-
way that he wanted something more "high-level", that's why I
mentioned libcurl as something to consider for (at least) part
of his task.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

Malcolm McLean 04-28-2012 10:46 AM

Re: High-level network programming: is C language suitable for that?
 
ื‘ืชืืจื™ืš ื™ื•ื ืฉื™ืฉื™, 27 ื‘ืืคืจื™ืœ 2012 23:37:41 UTC+1, ืžืืช Jens Thoms Toerring:
>
> That's just what, in the rest of my post, I thought I had
> mentioned;-) Though I wouldn't consider OpenGL to be a GUI
> library ("simple GUI" doesn't evoke the association of "fast
> 3D rendering" for me but more "a few buttons and maybe a few
> other useful widgets").
>

Open GL is a graphics library that mainly emphasises 3D rendering. However you seldom want an application that consists purely of a window containing a 3D scene. Open GL has a few 2D functions that allow you to add GUI type components on top of a window. The problem is you've got to write everythingfrom scratch, such as the code to add the highlight and lowlight to your buttons. That tends not to matter so much for games, where you want the GUI to have a customised, fun look and feel. But for serious applications you want the reverse, the same look and feel as the desktop. So the Open GL route isn't a good one.

nick_keighley_nospam@hotmail.com 04-29-2012 11:08 AM

Re: High-level network programming: is C language suitable for that?
 
On Friday, April 27, 2012 4:07:38 PM UTC+1, pozz wrote:
> Il 27/04/2012 16:27, nick_keighley ha scritto:
> [...]
> >> For gra-
> >> phics the only cross-platform library for C I know about is
> >> GTK+ (but I never used it) - most other seem to require C++.

> >
> > openGL, Qt

>
> QT? I knew QT was for C++ and not C language.


quite correct, I misremembered

nick_keighley_nospam@hotmail.com 04-29-2012 11:15 AM

Re: High-level network programming: is C language suitable for that?
 
On Friday, April 27, 2012 6:07:08 PM UTC+1, Jens Thoms Toerring wrote:
> nick_keighley_nospam@hotmail.com wrote:
> > On Thursday, April 26, 2012 8:54:40 PM UTC+1, Jens Thoms Toerring wrote:


> > > Of course, all this can be done in C (most scripting languages
> > > are actually implemented in C, so everything you can do in
> > > those languages can obviously be done in C).

>
> > this is a theoretically true but practically useless.

>
> Well, the OP was asking "if C language is good enough for that";-)


true, but implementing a script langauge before you start implementing the real problem may be an indication you've picked the wrong langauge. Though the Lisp metalinguists may disagree as might Fowler's "Domain Specific Languages"

> > > But note that C
> > > has no "native" support for networking or graphics, thus the
> > > need for additional (cross-platform) libraries (unless you're
> > > keen to re-invent the wheel;-). For TFTP and other protocols
> > > libcurl seems to be a candidate to take a look at. I don't
> > > know about BOOTP (wasn't that obsoleted by DHCP?). For gra-
> > > phics the only cross-platform library for C I know about is
> > > GTK+ (but I never used it) - most other seem to require C++.

>
> > openGL, Qt

>
> I fear using OpenGL for a simple GUI might not be too
> suitable since it's a rendering library and what you
> want for most simple GUIs is a set of widgets you can
> easily manipulate,


I've used an inhouse GUI tool that was built on top of OpenGL, though of course building that's extemly non-trivial!

There's GLUT that claims to be a GUI interface

which isn't what OpenGL meant for
> if I didn't mis-understand its purpose. Qt is defini-
> tely C++ and I guess it could be a real pain if one
> would try to marry it to a C program...
>
> Regards, Jens
> --
> \ Jens Thoms Toerring ___ jt@toerring.de
> \__________________________ http://toerring.de




On Friday, April 27, 2012 6:07:08 PM UTC+1, Jens Thoms Toerring wrote:
> nick_keighley_nospam@hotmail.com wrote:
> > On Thursday, April 26, 2012 8:54:40 PM UTC+1, Jens Thoms Toerring wrote:
> > > Of course, all this can be done in C (most scripting languages
> > > are actually implemented in C, so everything you can do in
> > > those languages can obviously be done in C).

>
> > this is a theoretically true but practically useless.

>
> Well, the OP was asking "if C language is good enough for that";-)
>
> > > But note that C
> > > has no "native" support for networking or graphics, thus the
> > > need for additional (cross-platform) libraries (unless you're
> > > keen to re-invent the wheel;-). For TFTP and other protocols
> > > libcurl seems to be a candidate to take a look at. I don't
> > > know about BOOTP (wasn't that obsoleted by DHCP?). For gra-
> > > phics the only cross-platform library for C I know about is
> > > GTK+ (but I never used it) - most other seem to require C++.

>
> > openGL, Qt

>
> I fear using OpenGL for a simple GUI might not be too
> suitable since it's a rendering library and what you
> want for most simple GUIs is a set of widgets you can
> easily manipulate, which isn't what OpenGL meant for
> if I didn't mis-understand its purpose. Qt is defini-
> tely C++ and I guess it could be a real pain if one
> would try to marry it to a C program...
>
> Regards, Jens
> --
> \ Jens Thoms Toerring ___ jt@toerring.de
> \__________________________ http://toerring.de




All times are GMT. The time now is 04:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.