473,748 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cross-platform: Coloured text, Networking, Multithreading


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?
Nov 12 '08 #1
42 2633
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).

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?
Perhaps you could ask in comp.programmin g.threads, where the
threading experts hang out?

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.

--
Er*********@sun .com
Nov 12 '08 #2
On Nov 12, 6:00 pm, Tomás Ó hÉilidhe <t...@lavabit.c omwrote:
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 '08 #3
On Nov 12, 11:27*pm, Eric Sosman <Eric.Sos...@su n.comwrote:
Perhaps you could ask in comp.programmin g.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.
Nov 12 '08 #4
In article <1226507251.342 302@news1nwk>,
Eric Sosman <Er*********@su n.comwrote:
....
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.)
Nov 12 '08 #5
Tomás Ó hÉilidhe wrote:
On Nov 12, 11:27 pm, Eric Sosman <Eric.Sos...@su n.comwrote:
>Perhaps you could ask in comp.programmin g.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.
When you write your automobile crash simulator in C, be sure
to come here with your questions about the deformation energies
of carbon-fiber composite structural members.

When you use C to write the control program for a microwave
oven, be sure to come here with your questions about safe cooking
times and temperatures for various foodstuffs.

When you're using C to solve differential equations, be sure
to come here with your questions about the relative merits of
Runge-Kutta methods vs. Adams-Bashforth/Adams-Moulton methods.

When you're using C to render synthetic images, be sure to
come here with your questions about the relative efficacy of
different depth cues on texture-mapped non-flat surfaces.

If you want to know anything at all about any subject
whatsoever, Tomás, all you need to do is write a C program --
or even just contemplate writing a C program -- that somehow
touches on that subject, however remotely, and then bring
all your questions here. Here in comp.lang.c you will find
self-styled experts in every conceivable branch of knowledge,
happy to answer any question you might pose. "I'm planning
to write a C program to simulate the actions of God Almighty.
Can somebody please tell me why He rested on the seventh day?
Exactly how tired was He, and what does His tiredness imply
about His omnipotence?"

--
Er*********@sun .com
Nov 12 '08 #6

"Kenny McCormack" <ga*****@shell. xmission.comha scritto nel messaggio
news:gf******** *@news.xmission .com...
>
You will soon learn that this newsgroup is about everything except C.
So split it. comp.lang.c and comp.lang.iso-c :)
Nov 12 '08 #7
In article <49************ ***********@rea der5.news.tin.i t>,
Lorenzo Villari <vl****@alice.i twrote:
>
"Kenny McCormack" <ga*****@shell. xmission.comha scritto nel messaggio
news:gf******* **@news.xmissio n.com...
>>
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.obscu rely_academic.i so-only.andNothing Else, 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.

Nov 12 '08 #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.programmin g.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.

Nov 12 '08 #9
Tomás Ó hÉilidhe wrote:
On Nov 12, 11:27 pm, Eric Sosman <Eric.Sos...@su n.comwrote:
>Perhaps you could ask in comp.programmin g.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, ...
Nov 12 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2051
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
12
3879
by: * ProteanThread * | last post by:
but depends upon the clique: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=954drf%24oca%241%40agate.berkeley.edu&rnum=2&prev=/groups%3Fq%3D%2522cross%2Bposting%2Bversus%2Bmulti%2Bposting%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den ...
0
1891
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
4
5583
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count of defect type by calendar month. Defect types are stored in one table, defect transactions in another along with date etc. When I cross-tab the results, defect types that have no defects recorded against them appear as a blank (null) value. That...
23
6541
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the queue, grab it and run a system command. Now I want to make sure that system command doesn't hang forever, so I need some way to kill the command and have the worker thread go back to work waiting for another queue entry.
0
2057
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
1
2764
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I have a table containing records for each job done, the records contain date, employee name, job done (a code representing the type of job), cost code (another code), regular hours, and overtime hours. The tricky part is that more than one job can...
6
8633
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have tried, including my conclusions/assumptions (which i'll happily be corrected on if it solves my problem!): The requirement not to use a proxy means I can't use the synchronous
6
5481
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or suggestions are welcome. --
6
3988
by: ampo | last post by:
Hello. Can anyone help with cross-domain problem? I have HTML page from server1 that send xmlHTTPRequest to server2. How can I do it? Thanks.
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.