Cross-platform: Coloured text, Networking, Multithreading

Discussion in 'C Programming' started by Tomás Ó hÉilidhe, Nov 12, 2008.

  1. I'm currently writing a program and I've got in mind to keep it as
    portable as possible. In particular I want it to run on Linux and
    Windows, but I'm also keeping an open mind to any machine that has a
    screen and is capable of Ethernet networking. The program requires
    three things that aren't available in the C Standard:
    1) Coloured text (for a console application)
    2) Raw socket networking
    3) Multithreading

    For number 1, I've already written my own tiny little cross-platform
    library (it uses ANSI escape sequences for Linux, and Win32 API
    functions for Windows).

    For number 2, I've again written my own tiny little cross-platform
    library (it uses Berkeley Sockets for Linux, and winpcap for Windows
    -- I would have used Winsock for Windows but Winsock no longer
    supports raw sockets).

    For number 3, well I'm just about to delve into it now. I see that
    somebody has already ported the "pthreads" library to Win32, so that
    looks like a very attractive option. Just before I go down that road
    though, I'd like to ask if anyone has a better idea than to use
    pthreads?
     
    Tomás Ó hÉilidhe, Nov 12, 2008
    #1
    1. Advertising

  2. Tomás Ó hÉilidhe

    Guest

    On Nov 12, 6:00 pm, Tomás Ó hÉilidhe <> wrote:
    > I'm currently writing a program and I've got in mind to keep it as
    > portable as possible. In particular I want it to run on Linux and
    > Windows, but I'm also keeping an open mind to any machine that has a
    > screen and is capable of Ethernet networking. The program requires
    > three things that aren't available in the C Standard:
    > 1) Coloured text (for a console application)
    > 2) Raw socket networking
    > 3) Multithreading
    >
    > For number 1, I've already written my own tiny little cross-platform
    > library (it uses ANSI escape sequences for Linux, and Win32 API
    > functions for Windows).


    How cute. Why do we need to know all this?

    > For number 2, I've again written my own tiny little cross-platform
    > library (it uses Berkeley Sockets for Linux, and winpcap for Windows
    > -- I would have used Winsock for Windows but Winsock no longer
    > supports raw sockets).


    How cute. Why do we need to know all this?

    > For number 3, well I'm just about to delve into it now. I see that
    > somebody has already ported the "pthreads" library to Win32, so that
    > looks like a very attractive option. Just before I go down that road
    > though, I'd like to ask if anyone has a better idea than to use
    > pthreads?


    So you're asking about threading, concurrency, and thread libraries in
    comp.lang.c. You're going to have to try harder if you expect to troll
    someone. (hint: try an unrelated rant about gypsies in your post)
     
    , Nov 12, 2008
    #2
    1. Advertising

  3. On Nov 12, 11:27 pm, Eric Sosman <> wrote:

    > Perhaps you could ask in comp.programming.threads, where the
    > threading experts hang out?



    Your sarcasm is a little addictive but I'll try to resist. I asked the
    question on comp.lang.c because I'm writing a program in C.

    I could imagine, if I asked the question over on c.p.t, that they'd
    direct me here.
     
    Tomás Ó hÉilidhe, Nov 12, 2008
    #3
  4. On Nov 12, 11:39 pm, wrote:

    > How cute. Why do we need to know all this?



    Because your head is vacuous and I wanted to offer you a filler.


    > So you're asking about threading, concurrency, and thread libraries in
    > comp.lang.c.



    Which thread have you been reading? Nope, never mentioned anything
    about concurrency; that was your own mental masturbation taking over
    to throw in a buzz word to show the big kids that you actually have a
    clue what you're talking about.

    I'm writing a program in C and I'm asking for advice on what threading
    library to use in C. If you don't have the answer, please don't do a
    dance to distract is from your lack of knowledge.
     
    Tomás Ó hÉilidhe, Nov 12, 2008
    #4
  5. In article <1226507251.342302@news1nwk>,
    Eric Sosman <> wrote:
    ....
    > No, never mind, that's too obvious, where's the adventure in
    >getting useful answers from experts when you could instead get a
    >boatload of nonsense from non-experts? Much more entertaining to
    >do it your way, I suppose.


    Thank you for confirming everything I (and other truth tellers, er, I
    mean, trolls) have been saying about CLC for years.

    (That this newsgroup is populated by a bunch of nattering fools.)
     
    Kenny McCormack, Nov 12, 2008
    #5
  6. In article <>,
    Tomás Ó hÉilidhe <> wrote:
    ....
    >> How cute. Why do we need to know all this?


    Typical clc jabber. Note that vippy is our latest reg wannabee, so he
    tries extra hard.

    >Because your head is vacuous and I wanted to offer you a filler.


    Yup - you got his number.

    >> So you're asking about threading, concurrency, and thread libraries in
    >> comp.lang.c.

    >
    >
    >Which thread have you been reading? Nope, never mentioned anything
    >about concurrency; that was your own mental masturbation taking over
    >to throw in a buzz word to show the big kids that you actually have a
    >clue what you're talking about.
    >
    >I'm writing a program in C and I'm asking for advice on what threading
    >library to use in C. If you don't have the answer, please don't do a
    >dance to distract is from your lack of knowledge.


    You will soon learn that this newsgroup is about everything except C.
     
    Kenny McCormack, Nov 12, 2008
    #6
  7. In article <491b1a7f$0$40306$>,
    Lorenzo Villari <> wrote:
    >
    >"Kenny McCormack" <> ha scritto nel messaggio
    >news:gff3bu$cv$...
    >>
    >> You will soon learn that this newsgroup is about everything except C.
    >>

    >
    >So split it. comp.lang.c and comp.lang.iso-c :)


    Exactly.

    As I've pointed out many times in the past, the (real, core) problem is
    simply that this group is misnamed. If it were named something like
    comp.lang.obscurely_academic.iso-only.andNothingElse, then the
    discussions occurring here would be entirely correct and justified.

    Or, to put it another way, the people who should have gone out and
    created (new-grouped) c.l.o.i.a decided instead to invade and take over
    this group. And things haven't been the same since.
     
    Kenny McCormack, Nov 12, 2008
    #7
  8. On 12 Nov 2008 at 16:27, Eric Sosman wrote:
    > Tomás Ó hÉilidhe wrote:
    >> I see that somebody has already ported the "pthreads" library to
    >> Win32, so that looks like a very attractive option. Just before I go
    >> down that road though, I'd like to ask if anyone has a better idea
    >> than to use pthreads?

    >
    > Perhaps you could ask in comp.programming.threads, where the
    > threading experts hang out?


    Oh come on, Eric - it hardly takes a world expert on threading to be
    able to say that pthreads is an excellent choice, and if it's available
    on all the target platforms then go for it.
     
    Antoninus Twink, Nov 12, 2008
    #8
  9. Tomás Ó hÉilidhe wrote:
    > On Nov 12, 11:27 pm, Eric Sosman <> wrote:
    >
    >> Perhaps you could ask in comp.programming.threads, where the
    >> threading experts hang out?

    >
    >
    > Your sarcasm is a little addictive but I'll try to resist. I asked the
    > question on comp.lang.c because I'm writing a program in C.


    There is _no_ sarcasm in the suggestion that when using features that
    are not standard C but which have supporting newsgroups that you not ask
    in a newsgroup for C (where those features are not topical) but in a
    newsgroup specifically for those features (where those features are
    obviously topical).

    When you write programs using threads, something not supported by C but
    by specific implementations on specific platforms, you are outside the
    realm of writing programs in C.

    > I could imagine, if I asked the question over on c.p.t, that they'd
    > direct me here.


    Then they have no idea of what either C or threads are. I can't believe
    that the folks in cpt are that clueless. But if your post is any
    indication, ...
     
    Martin Ambuhl, Nov 12, 2008
    #9
  10. Tomás Ó hÉilidhe wrote:
    > On Nov 12, 11:39 pm, wrote:


    >> How cute. Why do we need to know all this?


    > Because your head is vacuous and I wanted to offer you a filler.


    I suppose you think that is clever. It only marks you as at least one
    of an idiot or a boor. You haven't yet made it to my killfile, but keep
    it up and you will. I suspect that several people who could have been
    useful to you when you have a legitimate C question will have already
    sent you to their bozo bins.
     
    Martin Ambuhl, Nov 12, 2008
    #10
  11. In article <gff91f$e98$-september.org>,
    Martin "Mr. Compassion" Ambuhl <> wrote:
    >Tomás Ó hÉilidhe wrote:
    >> On Nov 12, 11:39 pm, wrote:

    >
    >>> How cute. Why do we need to know all this?

    >
    >> Because your head is vacuous and I wanted to offer you a filler.

    >
    >I suppose you think that is clever. It only marks you as at least one
    >of an idiot or a boor. You haven't yet made it to my killfile, but keep
    >it up and you will. I suspect that several people who could have been
    >useful to you when you have a legitimate C question will have already
    >sent you to their bozo bins.


    IOW, welcome to CLC. We hope you enjoy your stay.
     
    Kenny McCormack, Nov 12, 2008
    #11
  12. Tomás Ó hÉilidhe

    Default User Guest

    Martin Ambuhl wrote:

    > Tomás Ó hÉilidhe wrote:
    > > On Nov 12, 11:39 pm, wrote:

    >
    > > > How cute. Why do we need to know all this?

    >
    > > Because your head is vacuous and I wanted to offer you a filler.

    >
    > I suppose you think that is clever. It only marks you as at least
    > one of an idiot or a boor. You haven't yet made it to my killfile,
    > but keep it up and you will.


    He made mine a long time ago. He started this same crap on
    comp.lang.c++ back when. He even tried to start a cross-platform C++
    newsgroup, but I don't think it went anywhere.

    At any rate, he knows all about topicality rules. He's another that
    doesn't like them, so he chooses to behave like an ass.




    Brian
     
    Default User, Nov 12, 2008
    #12
  13. Tomás Ó hÉilidhe

    jameskuyper Guest

    Tomás Ó hÉilidhe wrote:
    > On Nov 12, 11:27�pm, Eric Sosman <> wrote:
    >
    > > Perhaps you could ask in comp.programming.threads, where the
    > > threading experts hang out?

    >
    >
    > Your sarcasm is a little addictive but I'll try to resist. I asked the
    > question on comp.lang.c because I'm writing a program in C.


    So, by the same logic, if you were writing a program that accumulated
    football statistics, you'd feel that the fact that it was written in C
    was sufficiently good reason to post questions here about football
    arcana relevant to your program?

    Yes, I'm being sarcastic; but I'm also curious about how you reached
    such a bizarre conclusion.
     
    jameskuyper, Nov 12, 2008
    #13
  14. On Nov 12, 1:54 pm, Antoninus Twink <> wrote:
    > On 12 Nov 2008 at 16:27, Eric Sosman wrote:
    >
    > > Tomás Ó hÉilidhe wrote:
    > >> I see that somebody has already ported the "pthreads" library to
    > >> Win32, so that looks like a very attractive option. Just before I go
    > >> down that road though, I'd like to ask if anyone has a better idea
    > >> than to use pthreads?

    >
    > > Perhaps you could ask in comp.programming.threads, where the
    > > threading experts hang out?

    >
    > Oh come on, Eric - it hardly takes a world expert on threading to be
    > able to say that pthreads is an excellent choice, and if it's available
    > on all the target platforms then go for it.


    Perhaps not. But it would certainly take an expert on threading to
    know
    that the underlying Windows model does not adapt well to the pthread
    model
    thus leading to some subtle bugs when using thread based mutexes.
    I remember being burned by this a few years back. I have no idea if
    it is still a problem. This is the problem with non-expert advice,
    not only are the non-experts ignorant of something, they may well
    think
    that they are not (The bug was subtle and didn't hit at first.
    Before
    that my advice would have been, "Use pthreads, I have successfully
    used
    these when I needed Linux/Windows compatibility").

    - William Hughes
     
    William Hughes, Nov 12, 2008
    #14
  15. "William Hughes" <> wrote in message
    news:...
    On Nov 12, 1:54 pm, Antoninus Twink <> wrote:
    > > On 12 Nov 2008 at 16:27, Eric Sosman wrote:
    > >
    > > > Tomás Ó hÉilidhe wrote:
    > > >> I see that somebody has already ported the "pthreads" library to
    > > >> Win32, so that looks like a very attractive option. Just before I go
    > > >> down that road though, I'd like to ask if anyone has a better idea
    > > >> than to use pthreads?

    > >
    > > > Perhaps you could ask in comp.programming.threads, where the
    > > > threading experts hang out?

    > >
    > > Oh come on, Eric - it hardly takes a world expert on threading to be
    > > able to say that pthreads is an excellent choice, and if it's available
    > > on all the target platforms then go for it.


    > Perhaps not. But it would certainly take an expert on threading to
    > know
    > that the underlying Windows model does not adapt well to the pthread
    > model
    > thus leading to some subtle bugs when using thread based mutexes.
    > I remember being burned by this a few years back. I have no idea if
    > it is still a problem. This is the problem with non-expert advice,
    > not only are the non-experts ignorant of something, they may well
    > think
    > that they are not (The bug was subtle and didn't hit at first.
    > Before
    > that my advice would have been, "Use pthreads, I have successfully
    > used
    > these when I needed Linux/Windows compatibility").


    There are several options wrt porting some PThread applications over to
    Windows:

    http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx

    http://sourceware.org/pthreads-win32

    http://www.cygwin.com
     
    Chris M. Thomasson, Nov 12, 2008
    #15
  16. "Chris M. Thomasson" <> writes:
    > "William Hughes" <> wrote in message
    > news:...

    [...]
    >> Perhaps not. But it would certainly take an expert on threading to
    >> know that the underlying Windows model does not adapt well to the
    >> pthread model thus leading to some subtle bugs when using thread
    >> based mutexes. I remember being burned by this a few years back.
    >> I have no idea if it is still a problem. This is the problem with
    >> non-expert advice, not only are the non-experts ignorant of
    >> something, they may well think that they are not (The bug was
    >> subtle and didn't hit at first. Before that my advice would have
    >> been, "Use pthreads, I have successfully used these when I needed
    >> Linux/Windows compatibility").

    >
    > There are several options wrt porting some PThread applications over
    > to Windows:
    >
    > http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx
    >
    > http://sourceware.org/pthreads-win32
    >
    > http://www.cygwin.com


    That may be true, but it doesn't address the concerns raised by
    William Hughes. Once again, the folks in comp.programming.threads are
    likely to know a lot more about this than we are.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Nov 12, 2008
    #16
  17. Tomás Ó hÉilidhe

    Ian Collins Guest

    Richard Heathfield wrote:
    > (But then I find many things surprising.)


    When you stop, worry.

    --
    Ian Collins
     
    Ian Collins, Nov 13, 2008
    #17
  18. Richard Heathfield <> writes:

    >comp.lang.c already serves the purpose that you appear to have in mind for
    >comp.lang.iso-c, making that suggestion redundant.



    (not trolling) but the suggestion is *not* redundant.

    It comes with the suggestion that the name comp.lang.iso-c would provide a
    clearer label for those ill-informed about the current use of comp.lang.c

    --
    Chris.
     
    Chris McDonald, Nov 13, 2008
    #18
  19. Tomás Ó hÉilidhe

    Bartc Guest

    "Richard Heathfield" <> wrote in message
    news:...

    >> Tomás Ó hÉilidhe wrote:


    > Yes. He hit my killfile some months ago, for racism, of all things.
    >
    > I find it surprising that so many people who witnessed that discussion and
    > should therefore be aware of his racist attitude continue to enter into
    > further technical discussions with him despite the absence of any apology
    > or retraction on his behalf. (But then I find many things surprising.)


    Well, some people are more tolerant than others.

    "Richard Heathfield" <> wrote in message
    news:...
    > Lorenzo Villari said:
    >> So split it. comp.lang.c and comp.lang.iso-c :)


    > comp.lang.c already serves the purpose that you appear to have in mind for
    > comp.lang.iso-c, making that suggestion redundant.


    There is already c.l.c.moderated, which could serve the purpose of the
    ..iso-c suggestion.

    I don't have a problem with c.l.c being wider-ranging, especially as it's
    not very active at the minute.


    --
    Bartc
     
    Bartc, Nov 13, 2008
    #19
  20. Tomás Ó hÉilidhe

    James Kuyper Guest

    Bartc wrote:
    ....
    > "Richard Heathfield" <> wrote in message
    > news:...
    >> Lorenzo Villari said:
    >>> So split it. comp.lang.c and comp.lang.iso-c :)

    ....
    > There is already c.l.c.moderated, which could serve the purpose of the
    > .iso-c suggestion.


    Have you tried it? It can take weeks for a message to get through the
    c.l.c.moderated moderation queue. If someone had the spare time to take
    over moderation of that group and put more time into it than the current
    moderator does, it might be a reasonable alternative, but it isn't as
    things currently stand.
    Note: I'm not criticizing the current moderator: I have no idea how much
    of his time is required to keep the spam and other junk out of the
    newsgroup, but it's probably more time than I could afford to spend on
    that task.

    > I don't have a problem with c.l.c being wider-ranging, especially as
    > it's not very active at the minute.


    It's more than sufficiently active from my point of view. It currently
    receives more postings per day than I can easily keep pace with without
    interfering with the rest of my life. It takes up that much time despite
    the fact that I'm trying to ignore all postings from a small set of
    known trolls, and any thread started by Bill Cunningham.
     
    James Kuyper, Nov 13, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    372
  2. Venkat

    Coloured Buttons

    Venkat, Jun 30, 2003, in forum: HTML
    Replies:
    3
    Views:
    2,774
    Steve Pugh
    Jul 1, 2003
  3. sudip

    coloured text...

    sudip, Jul 1, 2005, in forum: C Programming
    Replies:
    4
    Views:
    417
    Dik T. Winter
    Jul 7, 2005
  4. Ghai

    coloured text in console

    Ghai, Apr 19, 2006, in forum: C++
    Replies:
    4
    Views:
    421
    Alf P. Steinbach
    Apr 19, 2006
  5. Jonathan Hartley

    cross-platform coloured text in terminal

    Jonathan Hartley, Apr 16, 2010, in forum: Python
    Replies:
    4
    Views:
    380
    Jonathan Hartley
    Apr 20, 2010
Loading...

Share This Page