Is IPC in standard C possible?

W

Waxhead

Hi folks!

I'm looking for a way to do make a single serverprogram handle request
from one or more client apps.
Even if it sounds a bit stupid I really can't find any good way of
doing this in C without using files. Also named pipes does not seem to
exist in C but I may offcourse be wrong about this.
 
A

aegis

Waxhead said:
Hi folks!

I'm looking for a way to do make a single serverprogram handle request
from one or more client apps.
Even if it sounds a bit stupid I really can't find any good way of
doing this in C without using files. Also named pipes does not seem to
exist in C but I may offcourse be wrong about this.

No, c89/90 and c99 do not support such. You can try
comp.unix.programmer
 
S

Stephen Sprunk

Waxhead said:
I'm looking for a way to do make a single serverprogram handle request
from one or more client apps.
Even if it sounds a bit stupid I really can't find any good way of
doing this in C without using files. Also named pipes does not seem to
exist in C but I may offcourse be wrong about this.

Standard C does not acknowledge that more than one program exists, so
therefore it does not provide any mechanisms for IPC.

Your platform likely provides APIs to do this, however. Win32/64 and
POSIX both do, but of course it's off-topic here. Check in a newsgroup
for your particular platform.

S
 
W

Waxhead

Stephen said:
Standard C does not acknowledge that more than one program exists, so
therefore it does not provide any mechanisms for IPC.

Your platform likely provides APIs to do this, however. Win32/64 and
POSIX both do, but of course it's off-topic here. Check in a newsgroup
for your particular platform.

S

My problem is that I'm going to run my program on two platforms
(Windows and Linux). This is one of the reasons that I'm searching for
a independent way of doing this.
 
?

=?ISO-8859-1?Q?Jo=E3o_Jer=F3nimo?=

Waxhead said:
My problem is that I'm going to run my program on two platforms
(Windows and Linux). This is one of the reasons that I'm searching for
a independent way of doing this.

Invent a portable interface for communicating to the other program and then write wrapper functions
for the platforms you port the program to...
I think some graphical toolkits also provide uniform IPC interfaces that will work in all the OSs
they run in... see GTK or wxwindows...

But it's off-topic in this NG, anyway...

JJ
 
S

Stephen Sprunk

Waxhead said:
My problem is that I'm going to run my program on two platforms
(Windows and Linux). This is one of the reasons that I'm searching for
a independent way of doing this.

Windows and POSIX may provide similar mechanisms; for instance most
sockets code is the same between the two, though Windows does require a
few extra calls and has slightly different prototypes for some functions
(like using int instead of size_t). They're close enough that you can
write code that will work on both, with the occasional #ifdef for the
OS-specific cruft.

If you want something more powerful, though, they diverge pretty
rapidly. Your best bet is to find a library that provides wrappers to
various OSes and presents a common API to your code. Obviously, that
limits your program's portability to wherever that library works, but
that may not be an issue for you. If you can't find a suitable library,
then write your own (as described above) and publish it :)

S
 
C

CBFalconer

Waxhead said:
Stephen Sprunk wrote:
.... snip ...

My problem is that I'm going to run my program on two platforms
(Windows and Linux). This is one of the reasons that I'm searching
for a independent way of doing this.

You aren't going to succeed. You need an interface module which
knows which system you are compiling for. Go to a suitable
newsgroup for information on how those modules should look.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top