Rev 450 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 450 | Rev 453 | ||
|---|---|---|---|
| Line 7... | Line 7... | ||
| 7 | using System.IO; |
7 | using System.IO; |
| 8 | 8 | ||
| 9 | public class DaemonConnection { |
9 | public class DaemonConnection { |
| 10 | private TcpClient tc; |
10 | private TcpClient tc; |
| 11 | private bool running; |
11 | private bool running; |
| 12 |
|
12 | // private string host; |
| 13 |
|
13 | // private int port; |
| 14 | private NetworkStream ns; |
14 | private NetworkStream ns; |
| 15 | 15 | ||
| 16 | const byte DEBUG_LEVEL = 2; //0, 1, 2, 3 |
16 | const byte DEBUG_LEVEL = 2; //0, 1, 2, 3 |
| 17 | 17 | ||
| 18 | private Queue canPackets = Queue.Synchronized(new Queue()); |
18 | private Queue canPackets = Queue.Synchronized(new Queue()); |
| Line 55... | Line 55... | ||
| 55 | 55 | ||
| 56 | public void thread() { |
56 | public void thread() { |
| 57 | byte[] data = new byte[1024]; |
57 | byte[] data = new byte[1024]; |
| 58 | int recv; |
58 | int recv; |
| 59 | while (running) { |
59 | while (running) { |
| 60 | Thread.Sleep( |
60 | Thread.Sleep(1); |
| 61 | //Console.Write("."); |
61 | //Console.Write("."); |
| 62 | if (ns.DataAvailable) { |
62 | if (ns.DataAvailable) { |
| 63 | recv = ns.Read(data, 0, data.Length); |
63 | recv = ns.Read(data, 0, data.Length); |
| 64 | if (recv == 0) |
64 | if (recv == 0) |
| 65 | break; |
65 | break; |