Coder Social home page Coder Social logo

asp-project's Introduction

ASP-Project

advanced system programming-socket

This project is to be done either by one student or by pairs (two students)

Write two programs (in C or in Java), a client and a server, to implement a simple remote shell connection. The server process and the client process will run on two different machines and the communication between the two processes is achieved using Sockets. The server task can be summarized as follows :

  • The server must start running before any client, and wait for connections.

  • When the server gets a client, it forks and let the child process take care of the client in a separate function, called serviceClient, while the parent process goes back to wait for the next client.

  • Then, the server’s child process

    1. uses " dup2()" to make the screen descriptor designate the client socket
    2. gets in an infinite loop then :
      • reads a shell command from the client’s socket,
      • if the client sends "quit", then the server’s child, closes socket and quits.
      • otherwise, it excutes command, using the " system()" library function,
  • The client process connects to the server, then

    • gets into an infinite loops
      1. reads a command from keyboard,
      2. write the command to the server,
      3. if command is "quit", closes socket and quits
      4. otherwise, reads command output from socket and displays them on the screen

Demo

  • Found out the ip address of server

    • use "ip a" command to see the ipv4 address
  • Start the server first
    image image ps: format is: ./server.exe 5000
    5000 is the port

  • Then start the client
    image image ps: format is: ./client.exe [ip address] [port]

STEPs

  • Input a shell command in the client.
  • The command will be sent to the server.
  • Server will read the shell command from the client.
  • Server will excute the command, and show the result in the client.
    image

CLOSE THE PROJECT

  • Close the client first, otherwise it will become the zombie

    • input "quit"
    • image
  • Then close the server

    • Input "quit"
    • ctrl c
    • image

asp-project's People

Contributors

weihaod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.