Giter Club home page Giter Club logo

network's Introduction

SNU Network project

simple chat program

  • MAC, linux (Windows 에서 안 될 수 있음(select 때문에...))
  • python3(3.6.2에서 테스트.)
  • socket

chat_client.py 와 chat_server.py 로 구성

기능

  • 로그인/ 로그아웃
  • 방 초대/ 나가기
  • 메세지 큐
message type을 정함
{
    "type": "login| logout| leaveRoom | invitation |message ",
    "content": "..."

}

Socket 주의 사항

  • socket.send() 를 할 때에는 encode('utf-8')을 해주고
  • socket.recv() 시에는 decode('utf-8')을 해주어야 한다
  • json.dumps() 는 따로 decode 해주지 않아도 된다.

가정한 점

  • 중복로그인은 없다.
  • 로그인 시 초대 메세지는 가장 최근 1개만 보여진다.
  • Select library는 window에서 작동하지 않을 수 있다.

실행 방법

  • python3 chat_server.py
  • python3 chat_client.py HOST_URL HOST_PORT

client menual

  • USER_ID : "A", "B", "C", "D" 4명
  • PASSWORD = "123"
  • !invite USER_ID 해당 유저를 방으로 초대한다.
  • !logout 로그아웃 한다.
  • !leaveRoom 방을 나간다.

network's People

Contributors

sangmoon avatar

Watchers

James Cloos avatar  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.