GithubHelp home page GithubHelp logo

auscanaoy / python-client-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from katmfoo/python-client-server

0.0 1.0 0.0 172 KB

A basic example of a TCP client/server network using Python's socket and threading library.

Python 100.00%

python-client-server's Introduction

Client-Server Network

A basic example of a TCP client/server network using Python's socket and threading library. The server uses instances of a client object and individual threads to listen to incoming data from each client while listening for new connections.

Running

  • Download the server.py and client.py python files for Python 3.
  • Run server.py. You will be prompted for a host and port for the server. If you are going to run the client on the same computer or local network as the server, use localhost as the host name. If you are going to run the client on a different network, use the computer's local IP address (the IP address that resembles one of these). The port can be any 16 bit number (lower than 65535), but must be forwarded on your router if the client will be on a different network.
  • Run client.py. If the server is running on the same computer, use localhost as the host. If the server is running on a different computer, but the same local network, use the local IP address of the computer that the server is running on. If the server is running on a different network, use the external IP address of the network that the server is running under (google what is my ip).

Usage

The client should successfully connect to the server. Each time the server accepts a new connection, it will print the connection information to the server console. When the server receives a message from any of the clients, it will print the message to the server console and bounce the messsage to all other clients (not the client that sent it).

On the client, just type in a message and hit enter to send it to the server. Due to the way the console works, if a message is sent to you while you are typing a message yourself, it will interrupt your typing.

python-client-server's People

Watchers

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