项目作者: Niewidzialny84

项目描述 :
A simple voice communicator in python
高级语言: Python
项目地址: git://github.com/Niewidzialny84/TIP_Project.git
创建时间: 2021-03-24T12:25:47Z
项目社区:https://github.com/Niewidzialny84/TIP_Project

开源协议:MIT License

下载


TIP_Project

A simple voice communicator in python for a studies project created in teams of two

Installing requirements

The intentional way of installing dependencies is running pip install -r requirements.txt command. However installation of PyAudio on Windows systems might result in error. If it does, then download appropriate binary file form here. For example if you have python 3.9.1 64-bit version you want to download PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl file.

It is highly recomended to use virtual enviroment

Running the server

Server can be run by executing command

  1. python Server/run.py <port>

where the port variable is optional and default port is 9999. Port also can be set using enviroment variable named PORT. Server runs on all interfaces.

Running the client

Client UI can be run from the realsed package from here or using the python command

  1. python Client/client.py

Communication schema

The server and client communicates using both TCP and UDP sockets where TCP is used as control to the connection, the UDP is used as voice delivery. Both apps share the same package wraping utility tool. TCP packages contain json values.

Default communication schema

By default to be allowed for proper communication some values must me established in a simple exchange:

  1. Client connects to socket, sends nickname
  2. Server recives nickname adds it to connected users table and sends to all clients updated client list
  3. Server responds to a nickname sending sessionID
  4. Client sends binded UDP port where voice datagrams will be transfered
  5. Communication can begin, voice packets are tranfered between users on UDP sockets
  6. (Optionally) Server disconnects or client disconnects sending respective packages

Table of packages

All presented packages contain KEY value which is used as a number describing package name.
























































Package Name Required Values Optional values JSON Example
ACK

{“KEY”: 0}

UNKNOWN_ERROR

{“KEY”: 1}

SEND_NICKNAME NAME

{“KEY”: 2, “NAME”: “John”}

SEND_NEW_USERS USERS

{“KEY”: 3, “USERS”: [“John”,”Adam”]}

DISCONNECT REASON

{“KEY”: 4, “REASON”: “Quit”}

SERVER_CLOSE

{“KEY”: 5}

SESSION SESSION

{“KEY”: 6, “SESSION”: 2}

CLIENT_PORT PORT

{“KEY”: 7, “PORT”: 5253}