Exemplo n.º 1
0
 public Node(int p)
 {
     port         = p;
     neighbours   = new Dictionary <int, Connection>();
     routingtable = new Routingtable();
     lock (routingtable) routingtable.Add(new Route(port, 0, "local"));
 }
Exemplo n.º 2
0
 internal void SendRoutingTable(Routingtable table)
 {
     lock (table) foreach (Route r in table.Values)
         {
             SendRoute(r);
         }
 }
Exemplo n.º 3
0
 public Connection(int n, TcpClient c, StreamReader r, StreamWriter w)
 {
     routingtable  = new Routingtable();
     neighbour     = n;
     _tcpClient    = c;
     _streamReader = r;
     _streamWriter = w;
 }
Exemplo n.º 4
0
        private void Setup()
        {
            routingtable = new Routingtable();

            var stream = (_tcpClient = new TcpClient("localhost", neighbour)).GetStream();

            _streamReader           = new StreamReader(stream);
            _streamWriter           = new StreamWriter(stream);
            _streamWriter.AutoFlush = true;
        }