255ce3a6d3127c702339d9c4f4ca79be91391e90
[sdk] / samples / net / networkFile / NetworkClient / client.ec
1 import "ecere"
2
3 class ClientApp : GuiApplication
4 {
5    void Main()
6    {
7       FileServerConnection connection = ConnectToFileServer("hitomi", 7649);
8       if(connection)
9       {
10          File f;
11          Log("Connected\n");
12          f = connection.Open("c:/boot.ini", read);
13          if(f)
14          {
15             int newsize;
16             uint * indexfs = null;
17             int c;
18
19             f.Seek(0, end);
20             newsize = f.Tell();
21             f.Seek(0, 0);
22
23             indexfs = renew indexfs byte[newsize];
24             c = f.Read(indexfs, newsize, 1);
25             delete f;
26
27             f = FileOpen("test.ini", write);
28             f.Write(indexfs, 1, c);
29             delete f;
30
31             // while(true) Sleep(1);
32          }
33          delete connection;
34       }
35    }
36 }