Sitemap
needlesdevlog

My personal devlog

Back on track

--

I basically spent the whole day (3/4+ hours) working on the project, compensating for the lost hours. And I gotta say I managed to do quite some work. Here’s what I’ve accomplished so far.

First things first, I made a module with the classes and definitions for the whole project, so everything is more organized and readable.

Then I implemented a lenght-first message system. Since I had problems with reading the incoming messages, I wrote a few lines in every send and receive routine. Now every one of them sends (or receives) the lenght first, in XML format of course, then the message itself. It was quite challenging to be honest, since I had to find a way for the lenght message to be of a fixed lenght, but I managed to find a way.

After making the code more readable, writing the server script again from scratch (more or less, I copypasted an example I found on internet, edited it to my needs then added more code) and doing the same with the client main, I got myself a working send and receive setup. I could write a message from the client and the server would show it on screen. This is a milestone for me.

Get Agostino Saviano’s stories in your inbox

Join Medium for free to get updates from this writer.

Last thing I did was solving some issues I was having with the XML parser module: I had to find a way to process escaping characters in the XML string. Funnily enough, I found this when I was trying to write “❤”. The parser thought that was a token so the whole software crashed. I fixed this by sanitizing the input first and replacing the guilty characters with the respective XML entity replacements.

The responsible code for sanitizing the input, made using a python dictonary

So, after all of this, I now have a working setup. Next things in the book:

☐ Making the software multi-user

☐ Writing a server class

Oh, and P.S. I switched my main editor from Atom to VS Code, and it’s awesome! Thanks to its integration, I’m learning to use git in the meanwhile too!

Going strong ;D

--

--