Wednesday, 7 March 2007

07/03/06 - FTAO John

John, here is how networking will look to your fine self, more or less. It might help you get some ideas of how to work it in.

Data is sent from and arrives at your system in lumps called "packets".
  • A packet contains 46bytes to 1.5kbytes of "some data".
  • It also contains a label saying the unique address of the person that sent it (some hex).
  • it also contains a "packet type" which we can use to identify between programming, "function call/public variable get", and arbitrary packets like TCIP internet ones.
  • All this data is CRC checked and therefore reliable, except bad data is simply thrown away so you have to make sure you don't miss data. TCIP handles this I think, we could use that? your area, look into it. I know how I'm doing it for programming.
SEND A PACKET:
To send a packet you:
  • call a method I give you which assembles data you pass it (maybe as an array with size) into 1 or more packets, and then sends it.
RECEIVE A PACKET:
  • when a packet turns up at a node, the node halts what ever task is now running. It is vital that the packet data be moved into the memory ASAP cos packets are ignored till its moved.
  • If its a program data packet some preloaded routines I make take over and do the programming shit.
  • If its a function call, well we have to talk about that, there are some QoS issues.
  • If its arbitrary data, an arbitrary routine could be called that generically handles arbitrary data, you can make this routine do whatever you want or nothing at all.
So thats it, thats how our network works.
Note:
  • Unlike most TCIP objects in java or whatever, when data arives, (in java terms) "an event is triggered", and it is handled there. Your welcome to disguise this by just buffering the data.
  • For a "simulation" of this, use UDP packets not TCIP (its the other half of TCIP). This is probably a better way of doing routed packets over the internet btw, as its simpler.
  • http://en.wikipedia.org/wiki/Reliable_User_Datagram_Protocol
    Look into this, its UDP but doesnt lose packets. It will rout over the internet. May be too complex, I don't know.
EDIT: a C implimentation of RUDP, although its not copypasteable.
http://plan9.bell-labs.com/sources/plan9/sys/src/9/ip/rudp.c

No comments: