We're given this assignment to make a tic-tac-toe game with server-client architecture. My professor wants the server to be built using raw sockets (even lower than TCP/UDP) and client side to be browser. Is that even possible? Assignment Spec
I know in the assignment spec it said TCP/IP but I asked my professor later on and she said raw as in lower. This an example of server using TCP she gave (which she doesn't want us to use):
# Import the required libraries
from socket import *
# Listening port for the server
serverPort = 12000
# Create the server socket object
serverSocket = socket(AF_INET,SOCK_STREAM)
# Bind the server socket to the port
serverSocket.bind(('',serverPort))
# Start listening for new connections
serverSocket.listen(1)
# For python 2.x use the following syntax for displaying strings:
print 'The server is ready to receive messages'
# For python 3.x use the following syntax for displaying strings:
#print('The server is ready to receive messages')
while 1:
# Accept a connection from a client
connectionSocket, addr = serverSocket.accept()
## Retrieve the message sent by the client
# For python 2.x use the following (no need to convert from byte string to unicode):
sentence = connectionSocket.recv(1024)
# For python 3.x use the following
# (explicit conversion from byte string to unicode using .encode() method):
#sentence = connectionSocket.decode().recv(1024)
#Modify the message
capitalizedSentence = sentence.upper()
## Send the modified message back to the client
# For python 2.x use the following (no need to convert from unicode to byte string):
connectionSocket.send(capitalizedSentence)
# For python 3.x use the following
# (explicit conversion from unicode to byte string using .encode() method):
#connectionSocket.send(capitalizedSentence.encode())
# Close the connection
connectionSocket.close()
So she wants us to go even lower than this.
So back to my question, is this possible? I have done some research and seem to find that browsers can't communicate with raw sockets. But she said she has done it, so I don't know at this point.