Git Product home page Git Product logo

socket-programming's Introduction

Socket-programming

This is a simple client-server model where a client program can chat with a dummy math server. The communication between client and server goes as follows:

  • The server gets started first and listens to a known port.
  • The client program is started as server IP and port is provided in the command line.
  • The client connects to the server and asks for user input. The user enters simple arithmetic expression as “7+5”,"5*3","10/2" or “10-2”. The input is sent to the server through connected socket.
  • The server receives the input from the client socket, evaluate the expression and sends the result back to the client.
  • The client should display the result from the server to the user and prompts for the next input, until the user terminates the client program by Ctrl+C.

Singleclient:

Server program Server.c is a single process server that can handle only one client at a time. An client program is in client.c

Multiclient:

Server program Server.c is a multi-process server that forks a process whenever it receives a new client request. Multiple server will be able to chat with the server concurrently. An client program is in client.c

Running Program:

First start the server then client can be connected....

  • Server:
    -> gcc server.c -o server
    ->./server [port no.]

  • Client:
    -> gcc client.c -o client
    -> ./client 127.0.0.0 [port no.]

Note: port number for client and server should be same.

socket-programming's People

Contributors

thrylos2307 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.