Git Product home page Git Product logo

client-server's Introduction

클라이언트-서버

소개

  • 소켓을 사용해서 클라이언트-서버 프로그램을 구현한다.

목적

  • 소켓 프로그래밍과 클라이언트-서버 구조를 이해한다.

조건

서버

  • 소켓을 듣고 클라이언트의 연결을 기다리고 메시지를 받으면 표준 출력에 출력하고 다음 클라이언트를 무기한 기다린다.
  • 1개의 명령 행 매개변수를 받는다. (포트 번호)
  • 클라이언트의 통신을 무한히 받고 처리하며 다수의 클라이언트가 같은 서버에 메시지를 보낼 수 있다. 서버는 SIGINT와 같은 외부 시그널이 입력될 경우만 종료한다.
  • 클라이언트 큐의 크기는 [5, 10] 이며 순차적으로 클라이언트 연결을 처리한다. (동시성은 필요하지 않다.)
  • 소켓 프로그래밍 라이브러리 함수가 반환하는 오류를 처리한다.

클라이언트

  • 서버에 연결을 요청하고 표준 입력에서 메시지를 읽고 종료한다.
  • 표준 입력에서 EOF가 나올 때까지 메시지를 그대로 읽고 전송한다.
  • 2개의 명령 행 매개변수를 받는다.(서버의 IP 주소, 서버의 포트 번호)
  • 반복적으로 메시지의 부분을 읽고 전송해서 임의의 큰 메시지를 처리한다.
  • 메시지의 모든 부분이 전송될 때까지 부분 전송을 처리한다.
  • 소켓 프로그래밍 라이브러리 함수가 반환하는 오류를 처리한다.

기능

  • 클라이언트가 표준 입력에서 입력한 임의의 길이의 메시지를 서버가 표준 출력에 출력

실행

C

  • 반드시 Makefile을 사용해서 빌드
  • 서버는 ./server-c (PORT) > (출력 파일), 클라이언트는 ./client-c (서버 IP) (서버 PORT) < (메시지 파일)

Python

  • 서버는 python server-python.py (PORT) < (출력 파일), 클라이언트는 python client-python.py (서버 IP) (서버 PORT) < (메시지 파일)

테스트

  • test/client-server.sh 파일을 실행하면 코드를 테스트

테스트 결과

  • 16/16

제작 기간

  • 2022.11.17 - 2022.11.23

출처

  • Purdue University (CS 422: Computer Networks)
  • 직접 작성한 코드: srcs 디렉토리의 소스 파일 (client-c.c, server-c.c, client-python.py, server-python.py)

client-server's People

Contributors

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