NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import socket, sys, time

class Usernames:
pass

print(" Welcome To NChatX ! A Simple Chat Application!n")

def option_prompt():
options = input(str(">> What Do You Want To Host As?[Client/Server]: "))
if options.lower() == "client":
print("")
client()
elif options.lower() == "server":
print("")
server()
else:
print("tERROR "+options+" Is Not An Optionn")
option_prompt()

def server():
s = socket.socket()
server_host = socket.gethostname()
time.sleep(3)
print("> Running As A Server Host!n")
print("> Server Running: [HOST:"+server_host+"]")
port = 5421
s.bind((server_host,port))
time.sleep(1)
print("> Server Binded [HOST:"+server_host+"] With HOST and PORT [PORT:"+str(port)+"]")
print("> Server Connection Key: "+server_host+"n")
name_Input = input(str("n>> Give Your Username: "))
name_Input2 = name_Input.encode()
s.listen(10)
conn, addr = s.accept()
conn.send(name_Input2)
name = Usernames()
client_input = conn.recv(1024)
client_input = client_input.decode()
name.first = client_input
print(name.first," has connected to this Server...")
print("----------------------------------------------")
print("")
while True:
message = input(str(">> "))
print("")
try:
message2 = message.encode()
conn.send(message2)
print(name_Input+" : "+message)
print("")
incoming_message = conn.recv(1024)
incoming_message = incoming_message.decode()
print(name.first+" : ",incoming_message)
print("")
except:
print(name.first," has disconnected...")
time.sleep(2)
quit()


def client():
s = socket.socket()
time.sleep(3)
print("> Running As A Client!n")
user_Input = input(str(">> Give Your Username: "))
server_host = input(str(">> Please Enter A Connection Key : "))
port = 5421
s.connect((server_host,port))
print("> Connected to chat server")
print("----------------------------------------------n")
user_Input2 = user_Input.encode()
s.send(user_Input2)
client_input = s.recv(1024)
client_input = client_input.decode()
name = Usernames()
name.first = client_input
while 1:
try:
incoming_message = s.recv(1024)
incoming_message = incoming_message.decode()
print(name.first+" : "+incoming_message)
print("")
message = input(str(">> "))
print("")
message2 = message.encode()
s.send(message2)
print(user_Input+" : "+message)
print("")
except:
print(name.first," has disconnected...")
time.sleep(2)
quit()

option_prompt()

     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.