Python 3 Programming Tutorial - Sockets: client server system

sentdex · 176K views · 2014 · 10:27

Open on YouTube

Python, Ruby & scripting languagesNetworking & internet infrastructuretutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it as the tutorial they followed when asking why their first Python socket client-server programs fail or how the server knows what a client wants.

Recommended by 0 people across 0 different months, 2016 to 2018.

What it is

A short sentdex tutorial that builds a basic Python 3 socket server which binds a port, listens for connections, and replies to text sent from telnet. The code is adapted from a Python 2.7 BinaryTides socket tutorial and ported to Python 3.

What people said

Cites T. McPhee · 2016-04 · Stack Overflow · on “Getting an error from my small Python sockets program. Returns "OSError: [WinError 10022] An invalid argument was supplied"”

I'm following a tutorial working with Python sockets: client servers, [here][1]. I've looked into similar problems but other people are just getting spelling errors and what not. Looking forward to finding a solution! import socket import sys from _thread import * host = '' port = 5555 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: s.bind((host, port)) except socket.error as e: print(str(e)) s.listen(5) def threaded_client(conn): conn.send(str.encode('Welcome, type your info \n')) while True: data = conn.recv(2048) reply = 'Server output: '+data.decode('utf-8') if not data: break conn.sendall(str.encode(reply)) conn.close() while True: conn, addr = s.accept() print('connected to:

Cites Eliran Suisa · 2017-08 · Stack Overflow · on “Python client-server (*lack of understanding)”

i got a challenge to create: messaging system comprised of 2 components - client and server. 3 types of messaging: 1) respond with current server time 2) respond with number of calls made to the server so far(*since it started running) 3) multiplication of two numbers. i have tried to do that with python, so i saw this video tutorial : [this video] and read this guide: [LINK] but i have a big lack understanding, how the server knows what the client asking for? and how the server can respond for each query, what can i see its only the bytes receive.. i hope that someone can help me i have only 24 hours to answer that (it's a challenge for work) note: im a new computer science student. thank you al

Cites Borut Matjasic · 2018-03 · Stack Overflow · on “python while true wierd error”

I am learning python currently for a month now because I want to write a server for my GameMakerStudio 2 game, which doesn't support threading and I need a server to be written in another language to make this available. Anyways... [this video] -tutorial url I was following this tutorial and unfortunately i get an error which is: /home/borut/PycharmProjects/Server/venv/bin/python /home/borut/PycharmProjects/Server/Server.py File "/home/borut/PycharmProjects/Server/Server.py", line 19 while True: ^ IndentationError: unexpected indent Process finished with exit code 1 And my code as followed on tutorial is: import socket import sys from _thread import * host = '' port = 5555 s = socket.socket(socke