Git Product home page Git Product logo

vits-tcp_server's Introduction

VITS-TCP_server

TCP server:

A simple process that runs on a machine and 'listens' to a specific port. Any client wanting to communicate with the server must connect to the server's port and establish a connection.

  1. Create a socket object.
  2. Bind the socket to the current machine on a specific port.
  3. Listen for connections made to the socket.
  4. Accept a connection.
  5. Send/Receive data.
  6. Close the connection.

Note: The server can handle multiple clients simultaneously by creating a new thread for each client.

Threaded TCP server:

Essentially, a TCP server capable of handling multiple clients concurrently.

The server creates a new thread for each client connecting to it.

A pool of threads is utilized to limit the number of threads that can be created and to reuse threads that are no longer in use. Using a pool of threads is more efficient than creating a new thread for each client, as creating a new thread is a heavy operation.

Building Docker

// build docker image
docker build -t vits .

// run container, specify your port you wish to run with
docker run -dit --gpus all -v $PWD/api:/api -p 9999:9999 --name vits vits python3 ./server.py --port 9999
docker run -dit --gpus all -v $PWD/api:/api -p 9998:9998 --name vits_kaiwater vits python3 ./server.py --port 9998
docker run -dit --gpus all -v $PWD/api:/api -p 9997:9997 --name vits_politics vits python3 ./server.py --port 9997

Restart Docker

因為有多隻 API run on 同一個 image, 重啟可以下下面的指令

docker restart $(docker ps -aqf "name=vits*")

API 使用情況

9999 for web, 憂鬱症 9998 for app 9997 for politics

vits-tcp_server's People

Contributors

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