• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

3SFE518 Computer System Organisation - Piping

Extracts from this document...


Coursework for:

Computer System Organisation


Malshani Nanayakkara



Introduction – About the Piping        3

Program Listing        4

Screenshots        7


        In order to be able to communicate between two terminals, pipes have been used. As pipes are FIFO structure (First In First Out), it is well suited to be used for such an application. Two pipes are created, one used to define a communication channel from the server terminal to the client and the other to define a communication channel from the client terminal to the server terminal. Lets call these two pipes, np1 and np2, where np1 is the connection from the client to the server.

        In the program running on the server terminal, the pipe np1 is opened in the read only mode.

...read more.



    int ReadFromPipe, WriteToPipe, return_val, NumChar;

    char buffer[MAX_BUF_SIZE];

               // Create the first named pipe

    return_val = mkfifo(NP1, 0666);

    if ( return_val == -1 && errno != EEXIST)


        perror("Error creating the named pipe");



        //creates second named pipe

    return_val = mkfifo(NP2, 0666);

    if (return_val == -1 && errno != EEXIST)


        perror("Error creating the named pipe");



            /* Open the first named pipe for reading */

        /* Open the second named pipe for writing */

    ReadFromPipe = open(NP1, O_RDONLY);

    WriteToPipe = open(NP2, O_WRONLY);



                   /* Read from the first pipe */

        NumChar = read(ReadFromPipe, buffer, MAX_BUF_SIZE);

...read more.


//Reference: http://developers.sun.com/solaris/articles/named_pipes.html

#include <stdio.h>

#include <errno.h>

#include <ctype.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h>

#include "fullduplex.h" /* For name of the named-pipe */

int main()


    int WriteToPipe, ReadFromPipe, NumChar;

    char rdbuffer[MAX_BUF_SIZE];

        /* Open the first named pipe for writing*/

        /* Open the second named pipe for reading */

    WriteToPipe = open(NP1, O_WRONLY);

    ReadFromPipe = open(NP2, O_RDONLY);

    printf("Start conversation. Say something: ");    




                /* Write to the pipe */

        write(WriteToPipe, rdbuffer, strlen(rdbuffer));

              /* Reads from the second pipe */

        NumChar = read(ReadFromPipe, rdbuffer, MAX_BUF_SIZE);

        rdbuffer[NumChar] = 0;        //ends the string by placing '0' in the next slot

        printf("Server says: %s\nYou say: ", rdbuffer);





...read more.

This student written piece of work is one of many that can be found in our University Degree Software Engineering section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related University Degree Software Engineering essays

  1. Programming Concepts. Andora Video is a small shop selling videos. The owner, Raul, wishes ...

    set 4 �9.99 0/% 17.5% �46.95 �46.953 pass 2 Cloverfield 8 �13.99 12% 17.5% �115.72 �115.72528 pass 3 Be Kind Rewind 13 �10.50 17% 17.5% �133.12 �133.121625 pass 4 The Lord of the Rings - 3 vol set 24 �30.00 25% 17.5% �634.50 �634.5 pass As can be seen, there were no logical errors in this version.

  2. MS Office solutions. Fantasy mobiles require: ...

    A if statement is used to determine which calculation should be made depending upon the radio button selected. The end calculation is displayed in the 'Answer' label. 2.7 Functional Testing Test No. Test Details Expected Result Actual Result 7.

  1. 3ISE517 Internet Application Programming - CGI

    Two names written 2. No name provided 3. Number written instead of the name 4. Letters and numbers mixed 5. No age provided 6. Age given outside the required range 7. Letters written instead of a number 8. No email address given 9. Email address without the '@' sign 10.

  2. software program specification and code for a DVD store

    { totalcost=DVDcost*number; cout << "\nSmall orders may be dispatched by special delivery to arrive within 2 hours."; cout << "\nTotal cost including VAT is: "; cout << totalcost+VAT; // total cost including VAT } else { totalcost=DVDcost*number; cout << "\nTotal cost including VAT is: "; cout << totalcost+VAT; } cout<<endl<<endl;

  1. Creating a database system for Mr Azizur Rahman, Mr Bilal Sheikh and Mr Iman ...

    Below is the is scanned recording sheet on Customer Details: Below is the scanned recording sheet on Current computer spec+ Faults with current PC+ Possible Solutions/User Requirements: In order to keep track of customers and their orders all information is currently recorded manually and kept in a file.

  2. Human Computer Interaction Project.

    Our research aimed at putting these claims to the test. We wanted to determine whether or not the digital camera is as accessible as it sounds. To discover if anyone can use it or only those from technical backgrounds. To answer questions such as have the manufactures made the design too advanced?

  1. This report is to describe the process I went through to create a 3D ...

    Fig 1.1 Next to be created was the top section to hold the screen. A standard primitive box was used again, with parameters of length 270, width 330, height 15. It was coloured black and renamed 'top section'. The object was then converted to an editable mesh to enable the

  2. Abstract This report is dedicated to demonstrating and critically reviewing new features and developments ...

    [8] Following are several examples. Example 1, in Windows 7, the desktop uses a ?superbar? taskbar (see Figure 1.2).

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work