This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorials:python_bbs:part_one [2017/03/08 12:33] apam |
tutorials:python_bbs:part_one [2022/10/31 08:12] avon created |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Python BBS - Part One ===== | + | |
+ | ==== Python BBS - Part One ==== | ||
I'll start off by explaining each section of the code, then give a listing of the entire source at the end. Please note, you will also need a config.ini that will look something like this: | I'll start off by explaining each section of the code, then give a listing of the entire source at the end. Please note, you will also need a config.ini that will look something like this: | ||
Line 110: | Line 111: | ||
try: | try: | ||
- | self.sendString(conn, "Welcome to my BBS on Node %s" % (node)) | + | self.sendString(conn, "Welcome to my BBS on Node %s" % (node + 1)) |
while True: | while True: | ||
Line 117: | Line 118: | ||
except RuntimeError: | except RuntimeError: | ||
- | print("Node %s hung up..." % (node)) | + | print("Node %s hung up..." % (node + 1)) |
- | print("Node %s offline." % (node)) | + | print("Node %s offline." % (node + 1)) |
nodes[node] = False | nodes[node] = False | ||
conn.close() | conn.close() | ||
Line 193: | Line 194: | ||
try: | try: | ||
- | self.sendString(conn, "Welcome to my BBS on Node %s" % (node)) | + | self.sendString(conn, "Welcome to my BBS on Node %s" % (node + 1)) |
while True: | while True: | ||
Line 199: | Line 200: | ||
except RuntimeError: | except RuntimeError: | ||
- | print("Node %s hung up..." % (node)) | + | print("Node %s hung up..." % (node + 1)) |
- | print("Node %s offline." % (node)) | + | print("Node %s offline." % (node + 1)) |
nodes[node] = False | nodes[node] = False | ||
conn.close() | conn.close() |