Links Powered by MicMac
Cocoa-C-Porting
Fink's translation team
Mac OSX, Fink and Unix
Client/Server Architecture
PowerPC Architecture - UML
System programming
Merise
Pierre-Loïc and Pascaline's wedding

Overview

Last modified: 22/04/2004 05:21:39 CEST
Author: Michèle Garoche contact

Contents - Overview - Diagrams - Client documentation - Server documentation - Functions documentation - Headers documentation - Client source code - Server source code - Functions source code - Headers source code -

[tcpcliserv]

v 1.0.0

Subject

Consider the following client server architecture:

Clients Ci send messages to two servers S1 and S2 through a MSQ, created beforehand by S1.

For each message extracted from the MSQ, the servers fork a process Pi. Process Pi does the requested job, sends the result to client Ci via the MSQ, and kills itself. Client Ci displays the result.

The servers and processes Pi communicate via pipes. If there are several pending messages, the servers fork as many processes Pi as required to do parallel processing.

The messages are made of:

The server S1 extracts the messages made of one or two numbers. Process Pi computes:

The server S2 extracts the messages made of words. Process Pi converts the word in lowercase.

To do:

Adaptation

As the system used to create this application handles the message queues at the kernel level, it was not possible to fully comply with the subject.

The following changes have been carried out:

Three types of clients send messages to three types of servers through three TCP/IP sockets on three different ports.

The messages are made of one integer, two integers, or a word.

Client1 and server1 deal with all types of requests on port 9877. Client2 and server2 deal with numbers on port 9878. Client3 and server3 deal with words on port 9879.

There can be as many clients as the system supports on each server.

For each message received through the socket, the server forks a new process. The process does the following job:

The results are sent by the child process to the client through the socket. A signal catches the end of the child process. A call to select synchronizes the requests.

An attempt has been made to handle accentuated characters, but it is obviously system-dependent.

Installation

Mac OS X users

Requirements:

Installing:

Compiling:

Other users

Requirements:

Installing:

Compiling

Usage

Mac OS X users

Open Terminal and go to the build folder inside the project folder

Launch the server with: ./tcpserv -a

Launch the client with: ./tcpcli -a 127.0.0.1

Other users

Go to the tcpservcli folder

Launch the server with: ./tcpserv -a

Launch the client with: ./tcpcli -a 127.0.0.1

Read the messages in server and client to learn more about using them.

Creation

The application was written on an iMac 1Go RAM with system MacOS 10.2.4, enhanced with the latest Developer Tools and with XFree86.

It was tested on the iMac and a PowerPC G3, both connected via a switch to an ADSL modem and sharing the same Ethernet connection.

The tests on the G3 were made while connecting it to the iMac via ssh and X11 forwarding.

The code was edited with Project Builder.

Documentation was elaborated with Doxygen.

The graphics were created with AppleWorks.

Credits

Code

Heavily inspired from the late W. Richard Stevens

Apple

iMac, G3, MacOS 10.2.4, Developer Tools, Project Builder, AppleWorks

Fink

Ports on Mac OS X of Unix Open Sources

XFree86: XFree86 Project Inc., Jeffrey Whitaker(maintainer)

Doxygen: Dimitri van Heesch <http://www.doxygen.org>, Thomas Kotzian(maintainer)

The indefatigable guys of fink-users and fink-beginners mailing lists among others:

Alexander Hansen

Martin Costabel

Ben Hines

The following forums which help to sort out some specific questions on C, sockets and unix tools:

dBForums: comp.unix.programmers and comp.lang.c

BSDForums: general BSD discussions

Mac OS X Hints forums

Macfora.com

Others

People who helped me and whose names I unfortunately forgot.


Generated on Sat Mar 1 04:09:03 2003 for tcpcliserv by doxygen


Contents - Overview - Diagrams - Client documentation - Server documentation - Functions documentation - Headers documentation - Client source code - Server source code - Functions source code - Headers source code -

Powered by Apache/1.3.41 (Darwin) PHP/4.4.8 on Mac OS X bluefish distributed.net Cssed icon Conglomerate icon Valid HTML 4.0.1 Valid CSS
Local date (dd/mm/yyyy): 29/08/2008 06:08:16 CEST