Coder Social home page Coder Social logo

humorbei / cross-network-communication Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soloboyy/cross-network-communication

0.0 0.0 0.0 602 KB

This is a C++ assignment goal is to provide communication between the client and server across the network using the TCP/IP protocol. Specifically, the client-side end of a request channel will reside on one machine, and the server-side end of the channel on a different machine. Since the communication API (not just the underlying functionality a

C++ 97.58% Makefile 2.42%

cross-network-communication's Introduction

Cross-Network-Communication

This is a C++ assignment goal is to provide communication between the client and server across the network using the TCP/IP protocol.

Specifically, the client-side end of a request channel will reside on one machine, and the server-side end of the channel on a different machine. Since the communication API (not just the underlying functionality and features) through TCP/IP is different from FIFO, we are able to adapt the system to accpet port numbers and IP's, to faciliate this cross network connection. I also made sure to make the server dynamic, in the sense that it can handle multiple request channels from the client residing on a different machine.

This project was part of my operating systems class, and was recently moved to my public repo.

Background

Our client.cpp that consists of p patient threads, w worker threads, h histogram threads, and accomplishes file transfer using TCP/IP request channels.

Skeleton code for TCPRequest Channel class TCPRequestChannel{ private: /* Since a TCP socket is full-duplex, we need only one. This is unlike FIFO that needed one read fd and another for write from each side / int sockfd; public: / Constructor takes 2 arguments: hostname and port number If the host name is an empty string, set up the channel for the server side. If the name is non-empty, the constructor works for the client side. Both constructors prepare the sockfd in the respective way so that it can work as a server or client communication endpoint*/ TCPRequestChannel (const string hostname, const string port_no); /* This is used by the server to create a channel out of a newly accepted client socket. Note that an accepted client socket is ready for communication / TCPRequestChannel (int sockfd); / destructor / ~TCPRequestChannel(); int cread (void msgbuf, int buflen); int cwrite(void* msgbuf , int msglen); /* return the socket file descriptor */ int getfd(); };

Example Commands

  • Start Server with ./server -r -m
  • Reveal Server IP address with ngrok, ifconfig, ip addr | grep eth0
  • ./client -n <# data items> -w <# workers> -b -p <# patients> -h <# histograms> -m -a <hostname / IP address> -r
  • ./client -w <# workers> -b -f -m -a <hostname / IP address> -r

cross-network-communication's People

Contributors

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