Hi,
I know that some older Unix programs that compile with GCC use socket.h to
connect to and execute other programs. However, I am using Visual C++ 6.0
and it doesn't seem to have socket.h included. Is there any standard
cross-platform way (ie can compile in both Visual C++ 6 and GCC) to execute
and connect to other programs?
They needn't be older and needn't be compiled with GCC; sockets using
several header files of which socket.h is only the first are standard
on all Unices regardless of compiler, and some other systems also.
Windows (since at least NT) provides a sockets interface that is
similar but not identical to Unix (Berkeley) sockets as long as you
avoid advanced(?) features like nonblocking and mixed poll(). One
right-up-front difference is that it mostly uses only a single header
file, winsock2.h, instead of the dozen or so in Berkeley.
With some care and only a few #if's you can write source that compiles
on both Unix and Windows, but you can't expect source written for Unix
and without planning for this to work on Windows. If all you want is
to run on Windows machines, you might also look at cygwin,
www.cygwin.com, which provides a Unix "emulation" layer on Windows.
That uses (a port of) GCC, not VC++.
Note that sockets (and TCP/IP) only allow to connect to remote things
and exchange data; they can't by themselves execute anything. They can
be used to send a _request_ to something typically a demon on a remote
system _asking_ it to execute something for you.
- David.Thompson1 at worldnet.att.net