Closed Starlight-30036225 closed 10 months ago
I have created the basic server class. Currently, there is no client for it to connect too but it should be functionally sound.
This snippet is creates a connection with an incoming client, binds it to the connection handler class and places it in the thread pool so the server can focus on incoming connections.
Inside the ConnectionHandler class:
Now when a client is bound to the Connection handler, it will be sent a request for its nickname (Just a tester will be changed later), then print the nickname. Then send a welcome message with the applied nickname.
This will make a quick test when the client side is built
I chose to differ from the video for the client class, the creator elected to use a seperate thread to read inputs, I do not think this is currently necessary so I am simplifying it. This simply returns any received messages to the server.
So the clients 'nickname' should be "Enter a nickname"
Time to test it.
Perfect.
This is a very simple connection, but its a start. Ill comment this and close this issue.
https://www.youtube.com/watch?v=hIc_9Wbn704
Using the video marked above I intend to create a basic two way communication service that will be used later for the game.
For now I will not bother with packets, just creating the server and client sockets and allowing them to send arbitrary data is a solid enough start.
This should also give me the frame work for multiple clients, which can be later expanded into chat rooms and spectators.