Solved

client-server demo

Posted on 2000-04-07
1
207 Views
Last Modified: 2010-04-15
I need to write a simple tcp/ip client-server application where the client gets the server address and an exec to run as parameters and sends the exec to the server which runs itand returns the exit status of the exec.
if someone can give me a simple code to start with i'm sure to be able to continue from there.
oh and the server and client suppose to work on both unix and win95 (i was told it is different).
0
Comment
Question by:katzgal
1 Comment
 
LVL 2

Accepted Solution

by:
munsie earned 100 total points
ID: 2695214
this almost sounds like a school assignment....

anyway for some pointers, since that is what you are looking for, go grab a copy of Unix Network Programming Vol 1 by Richard W. Stevens.

A few pointers on making your source code work under Unix and Windows:

1. Unix uses ints for socket descriptors, Windows uses the SOCKET type:

so do the following:

#if defined unix
typedef SOCKET int;
#endif

2. Unix allows you to use read() and write() on a socket, Windows does not.

so, just use recv() and send()

3. Windows use WSGetLastError() to return errors, Unix uses errno.

again you can just define a macro:

#if defined unix
#define WSGetLastError() errno
#endif

that should cover most of the differences.  Look in the Visual C++ documentation for more info, but for simple TCP networking that should cover it.

i haven't found any books that cover both Unix and Windows networking, but the Unix Network Programming book will give you enough background in Unix to make the transition to Windows fairly easy.

good luck,
dennis
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
why debugging a macro i s difficult 10 34
Passing command line arguments in C 10 90
Problem to ASCII 1 178
Test the speeds on my PC Drives 12 48
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question