
Learn Python network applications with sockets by building terminal and gooey chat rooms and an online multiplayer game, using sockets, threading, and json serialization.
Learn to install Python from python.org, add Python 3.10 to your system path, and verify the interpreter. See how to use the command line or PowerShell and idle.
Install VS Code on Windows, add it to your path, install the Python extension, create a test.py with print hello world, and run it to verify the setup.
Create a dedicated Python socket examples folder on the desktop to store all Python scripts and ensure they run from the correct location, then begin building networked socket applications.
Explore how the internet and local networks work, including IPv4, public vs local IPs, ports, TCP vs UDP, and how Python sockets enable client–server communication.
Develop a tcp server using python's sockets module with ipv4 inet and socket stream, binding to a dynamic ip derived from the host name and listening for connections.
Learn to send data over a tcp connection by encoding messages to bytes, receiving with a max number of bytes, decoding with utf-8, and closing client and server sockets.
Demonstrate creating a Python UDP server and client with sockets, binding to IP and port, and exchanging data via receive from and send to in a connectionless setup.
Explore how TCP guarantees delivery by buffering and streaming data, even when messages exceed the buffer, while UDP may drop oversized datagrams.
Build a basic two-way chat over tcp sockets by creating server and client scripts, defining constants, encoding utf-8, binding, listening, and exchanging messages.
Learn how the threading module lets a server-client chat run concurrently, enabling a multi-client chat room by running send and receive tasks in separate threads.
Learn to implement a terminal chat room with Python sockets and threading by setting up server and client scripts, constants, host IP, port, UTF-8, and broadcast/receive functions.
Explore building a Python socket chat server and client: accept connections, manage client sockets and names, prompt for user names with a name flag, broadcast joins, and handle incoming messages.
Learn how to enable concurrent chat with threading: run separate send and receive threads for each client, format and broadcast messages, and handle disconnections on the server.
Learn how threading enables concurrent client-server messaging in a Python socket chat room. See the server broadcast to multiple clients and apply ANSI escape codes to color and format messages.
Learn to transform a terminal chat room into a graphical interface with Tkinter by defining a root window, organizing widgets in frames, setting geometry, colors, and a main loop.
Learn to add and attach input and output frames in a tkinter root window, and choose pack or grid layouts with padding and expand to shape the interface.
Build a Tkinter chat interface by adding radio buttons linked to a string variable to set text color, and arrange input and output frames with grid and pack.
Develop a Tkinter chat interface by adding a send message function, creating output labels, linking a button, and clearing the input to build a basic message display in a GUI.
Build a client-side gui chat room in Python using Tkinter, with three frames for info, output, and input, plus name/ip/port entries, connect/disconnect buttons, and socket and threading setup.
Builds a Tkinter chat client layout with an output frame, a list box and a vertical scroll bar, and an input frame for sending messages to a server.
Define socket constants and a global client socket, connect using IP and port, verify with the server, update the list box, and spawn a thread to receive messages.
Learn to build a Python socket-based GUI chat client: connect, disconnect, send and receive messages, and test with multiple clients, while refining UI states.
Learn how the pickle module serializes Python objects for socket data transmission using dumps and loads. Review security concerns, including a pickle bomb, and compare to JSON for safer serialization.
Train the safe transmission of Python objects by using the JSON module to dump dictionaries into strings, encode to bytes, and decode back with JSON loads over sockets.
Update the gui chat room client with color selection via radio buttons, implement a json-based message packet, and introduce admin privileges like kicking and banning, prepping for server-side integration.
Outline gui chat admin server functionality: introduce a connection class to hold the socket and functions: start, end, connect, broadcast, receive, process messages, private message, kick, ban.
Outline client side of Python socket chat app using a connection class to manage the client socket, with connect, disconnect, and JSON message packets with name, exit, and kick flags.
Build a Python socket server with a connection class to manage host IP, port, encoder, ban lists, and a thread that accepts clients and handles message packets.
Processes incoming client messages on the server by decoding json into a packet, handles info, message, and disconnect flags, broadcasts joins to all clients, and updates the server UI.
This lecture guides building a Python socket chat client GUI, detailing the client connection flow, JSON-based messages, info and disconnect flags, and starting a receive thread to handle server broadcasts.
Build a GUI chat using Python sockets, sending message packets from client to server and broadcasting them to all clients; display includes name and color with real-time server updates.
Learn to add admin controls to a Python socket chat server, enabling broadcast and private messages to selected clients via JSON-encoded packets and GUI list box selection.
Explore adding admin functionality to a Python socket GUI chat room, implementing disconnect flags, server-controlled socket closure, kick and ban actions, and broadcast updates across clients.
Run the server with multiple clients to test chat functions, including broadcast, private messages, kick and ban by IP, on a local network; discuss exposing the server across networks later.
Configure your host firewall to allow Python socket traffic over a local area network. Adjust Windows firewall settings to permit Python on private and public networks and test LAN connections.
Set a static IP address on your local network to keep the server at a consistent address and enable port forwarding for global communication.
Set up port forwarding on the router to forward traffic from the public IP and a specific port to the server's local static IP and port, enabling wan connections.
Test wide area network communication using a static IP and port forwarding to connect local and remote clients via sockets, then apply these concepts to a multiplayer game.
Configure a second router to enable external communication within a local network by using a MAC-based DHCP reservation to assign a static IP and set up port forwarding.
Install and use the pygame module to build games. Create a 600 by 600 window, set colors and fonts, and run a loop that handles events and updates the display.
Learn to structure a Pygame project with a player class and a game class, implementing initialization, update, and draw methods, and a frame-based countdown timer in the main loop.
Create a Pygame player class with initialization and update methods, track x, y, size, and color, and move the player using pressed keys within a 600-pixel window while updating coordinates.
Explore how fixed length headers solve varying packet sizes in socket communication, enabling reliable server-client messages through explicit header-driven sizing.
Discover how fixed length headers of ten bytes solve socket messaging headaches by signaling the next message size before sending the message, enabling reliable server and client communication.
Build an online multiplayer game using Python sockets, creating server and client APIs with threading, JSON, and time synchronization for synchronized gameplay.
Build a multiplayer game client by importing sockets, threading, and json, and defining connection, player, and game classes. Initialize a PI game window and main loop to manage state.
The server initializes the connection and game objects, sends room size, round time, frames per second, and total players to the client using fixed-length headers, and creates player objects.
Explore server-side player creation for an online multiplayer game, including initializing a player object, assigning starting conditions by number, and broadcasting the game state to clients via JSON.
Describe how the client receives server-created player objects via sockets, decodes headers and JSON data, initializes player attributes, updates game state, and renders players in the draw loop.
Connects clients to a server, broadcasts game configuration, and assigns a player object. Signals readiness when players press enter, and the server starts game only when all players are ready.
Coordinate client and server game state as players move rectangles, collide to score points, and reset to home bases; server computes scores and time and pushes state to all clients.
Learn to receive real-time player info through a server thread, process game state, handle collisions and scoring, and send updated state back to clients each loop.
Learn how a server processes and broadcasts the game state to all clients, including coordinates and server time, while clients receive, update, and render the state and scores.
Reset a multiplayer Python network game after a round by updating client and server states, clocks, and readiness, and syncing via status messages and server triggers.
Have you ever wanted to build your own online multiplayer game that you and your friends could play? How about wanting to build your own chat room like the golden AOL chat rooms from the 1990's that you and your friends could "hang out" it. Want to learn the underlying principles of how programs like these work - how they can communicate and send data back and forth from one computer to the next over the internet? If the answer is yes, then please consider taking this course!
I know in my own journey with Python and computer science, once I got past the basics...the fundamentals...the whole "this is a for loop. Can you print the first 100 even numbers?" type exercises, the doors really opened up. There was only one problem: the doors opened up to a HUGE space, with very little guidance. Python is great because you can do so much with it, especially when you start to bring in new modules and libraries that give added functionality. While there are ample beginner resources out there willing to hold your hand and guide you through the learning, I felt there were significantly less targeting this intermediate audience...The audience that has learned the basics and are now looking for something more...
In this course, I decided to focus my intermediate projects around networking applications; I wanted to write programs that could talk to each other online, both across my local area network and across the internet as a whole. With this in mind, I asked myself what are some fun and engaging projects students would enjoy learning with and what external modules and libraries should we know to accomplish these projects. In this course we will complete the following:
A two-way terminal based chat introducing the socket module
A terminal based chat room introducing the threading module
A GUI chat room introducing the Tkinter module
How to configure your router to allow communication from an external network
An advanced GUI chat room with admin window introducing the json/pickle modules
An online multiplayer game introducing the Pygame module
Each project builds on the knowledge gained during the previous projects. In our culminating project, when we attempt to create our own online multiplayer game, we will be generating IPV4/TCP sockets to connect computers to a server running on a machine with a static IP and port forwarding enabled, creating various threads to run processes concurrently on our machines, we'll use json to serialize python objects such as our game state and game players, and have a full interactive GUI interface using Pygame.
By the end of this course you will have multiple projects you can share with friends or family, have them run a client script from their house, connect to your server script, and show off all you learned.