Spelprogrammering III – 2nd Post

This week we’ve been working on creating a UDP Chatprogram, as a part of learning the class basic network coding.

In a nutshell, the program we are creating uses UDP to send packets of data to one and another containing messages using the console (It’s a mess when you get 26 people to do this at once though).

I’ll just dedicate this little bloggpost to what I’ve been learning, as I’ve been trying to define what everything is, and what everything does (on my free-time I might add).

We’re using something called Peer-to-peer, which is a network of connected nodes, in this case a network of IP’s (the classes IP’s). This means that we do not give each other specific roles in the communication, and there is no priviliges relative to each other. In other words, it’s a non hierarchical network.

So, in order to connect to one and another we’ve got to create something called a socket that is  bound to a specific transport service provider . A socket can be opened on any port; and this is where we add the adress(es) that we want to connect to. In our case, we were connected to one and another on the schools own network.

Example of initilazing a socket:


   SOCKADDR_IN target; // The socket adress information</pre>


   target.sin_family = AF_INET; // This is the address family: Internet
   target.sin_port = htons (//ex. 8080); //Port to connect on
   target.sin_addr.s_addr = inet_addr (IPAddress); //Target IP-address
 

There’s so much new syntax, but as soon as you start understanding the absolute basics, it’s not that hard to understand, quite frankly it becomes really really straight forward as soon as you’ve comprehend the basic syntax.

Now, our next assignment is to create a webbserver using c++, with the following requirements:

The server must be able to handle a basic subset of the HTTP/1.1 features:
﹣ Send HTTP/1.1 headers
﹣ Handle invalid GET requests
﹣ Keep connections alive by default
﹣ Respect the browsers connection header

Most of my time spent studying this is figuring out how HTTP (Hypertext Transfer Protocol) handles Client Requests and the Servers response. I’m still not quite sure how to get all of this to work. So, there’s not much I’m able to write about right now.

That’s about it for this week.