跨平台:彩色文本,网络,多线程 [英] Cross-platform: Coloured text, Networking, Multithreading

查看:59
本文介绍了跨平台:彩色文本,网络,多线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我目前正在编写一个程序,我已经考虑过尽可能保持便携式。特别是我希望它能够在Linux上运行,并且需要在Windows上运行,但我也对任何具有

屏幕且能够使用以太网的机器保持开放的态度联网。该程序需要

C标准中没有的三件事:

1)彩色文本(用于控制台应用程序)

2)原始套接字网络

3)多线程


对于1号,我已经编写了自己的小小跨平台

库(它使用Linux的ANSI转义序列,以及Windows的Win32 API

函数)。


对于数字2,我又来了写了我自己的小小跨平台

库(它使用Berkeley Sockets for Linux,winpcap for Windows

- 我会用Winsock for Windows但Winsock不再

支持原始套接字。


对于3号,我现在正要钻研它。我看到

有人已经移植了pthreads库到Win32,所以

看起来是一个非常有吸引力的选择。就在我走这条路之前

虽然,我想问一下是否有人比使用

pthreads有更好的想法?


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写道:
Tomás ó héilidhe wrote:

我正在写一个程序而且我已经进入介意保持它尽可能便携。特别是我希望它能够在Linux上运行,并且需要在Windows上运行,但我也对任何具有

屏幕且能够使用以太网的机器保持开放的态度联网。该程序需要

C标准中没有的三件事:

1)彩色文本(用于控制台应用程序)

2)原始套接字网络

3)多线程


对于1号,我已经编写了自己的小小跨平台

库(它使用Linux的ANSI转义序列,以及Windows的Win32 API

函数)。


对于数字2,我又来了写了我自己的小小跨平台

库(它使用Berkeley Sockets for Linux,winpcap for Windows

- 我会用Winsock for Windows但Winsock不再

支持原始套接字。


对于3号,我现在正要钻研它。我看到

有人已经移植了pthreads库到Win32,所以

看起来是一个非常有吸引力的选择。就在我走这条路之前

但是,我想问一下是否有人比使用

pthreads有更好的想法?
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?



也许你可以在comp.programming.threads中询问,

线程专家在哪里闲逛?


不,没关系,那太'显而易见了'

的冒险从专家那里获得有用的答案,而你可以获得一个

来自非专家的废话?我猜想,以你自己的方式更有趣。


-
Er ********* @sun.com


11月12日,6: 00 pm,Tomásóhéilidhe< t ... @ lavabit.comwrote:
On Nov 12, 6:00 pm, Tomás ó héilidhe <t...@lavabit.comwrote:

我正在写一个节目,我想到的是保持尽可能便携的b / b
。特别是我希望它能够在Linux上运行,并且需要在Windows上运行,但我也对任何具有

屏幕且能够使用以太网的机器保持开放的态度联网。该程序需要

C标准中没有的三件事:

1)彩色文本(用于控制台应用程序)

2)原始套接字网络

3)多线程


对于1号,我已经编写了自己的小小跨平台

库(它使用Linux的ANSI转义序列,以及Windows的Win32 API

函数)。
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?


对于2号,我再次写了我自己的小小跨平台

库(它使用Berkeley Sockets for Linux,winpcap for Windows

- 我会使用Winsock for Windows但Winsock不再

支持原始套接字)。
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?


对于3号,我现在正要钻研它。我看到

有人已经移植了pthreads库到Win32,所以

看起来是一个非常有吸引力的选择。就在我走这条路之前

但是,我想问一下是否有人比使用

pthreads有更好的想法?
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?



所以你在询问

comp.lang.c中的线程,并发和线程库。如果你想要玩耍,你将不得不更加努力。

某人。 (提示:尝试在你的帖子中对吉普赛人无关紧要的咆哮)

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)


11月12日晚上11点27分,Eric Sosman< Eric.Sos ... @ sun .comwrote:
On Nov 12, 11:27*pm, Eric Sosman <Eric.Sos...@sun.comwrote:

也许你可以在comp.programming.threads中询问,

线程专家在哪里闲逛?
Perhaps you could ask in comp.programming.threads, where the
threading experts hang out?



你的讽刺有点上瘾,但我会尽力抵制。我在comp.lang.c上问了

的问题,因为我正在用C编写一个程序。


如果我问这个问题,我可以想象在cpt上,他们会在这里指示我。


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.


这篇关于跨平台:彩色文本,网络,多线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆