Relay


Screen Shot of Application

Relay

This part of the application is accessable after a user
has logged into the application, the server side socket will
always be running however the client side sockes will only
be created and attempt to conenect to the server once the
current user has selected a another user to send a message to.

Source Code Example

import socket
import sys
import time
x = socket.socket()
h_name = socket.gethostname()
print(h_name)

port = 8080

# BINDING

x.bind((h_name, port))
print("Server done binding")
print("Server is waiting for incoming connections")
# LISTENING

x.listen(1)

# ACCEPTING

connection, address = x.accept()
print (address, "Has connected to the server")


while 1:
display_mess= input(str(">>"))
display_mess=display_mess.encode()
connection.send(display_mess)
print(" message has been sent...")
in_message=connection.recv(1024)
in_messagge=in_message.decode()
print(" Client:", in_message)

------------------------------------------------
The source code above is written in Python. The
task of the code snippet is to set up a server socket
that will accept incoming client socket connections
the code also allows the server side to send a message
aknowledging that the client was connected.
Currently i have written about 80 lines of code, about
40 on the server side and 40 on the client side

Interesting Features

An interesting feature of the application is that
a user will be able to send a direct message to another
user without other user being able to see it
another feature we will implement is the ability for app
to delete messages immedietly and never store them
this will illemeinate the need for storage space and
will result in a simpler and managable database

Additional

As of today i would say the application is about 10% complete
However my partner an i intend to commit more changes to the repo
in the comming days.
The most interesting thing i have learned since starting the project
is that a server will be required to act as a hsot between two users
sending messages to each other. it isnt possible for the users to send
messages directly to each other without a host acting as the middleman