ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Smersh/Daemon.cpp
(Generate patch)

Comparing Smersh/Daemon.cpp (file contents):
Revision 173 by Douglas Thrift, 2004-06-21T03:15:47-07:00 vs.
Revision 174 by Douglas Thrift, 2004-06-21T20:16:43-07:00

# Line 8 | Line 8
8  
9   void Daemon::serve(int port, bool fork, Daemon* self)
10   {
11 <        // bind
11 >        api::TcpSocket server;
12 >
13 >        server.Create();
14 >        server.SetAddress(api::InternetAddress(api::InternetAddress::Any, port));
15  
16          if (fork)
17          {
# Line 25 | Line 28 | void Daemon::serve(int port, bool fork,
28                  }
29          }
30  
31 <        // listen
31 >        server.Listen(50);
32  
33          while (true)
34          {
35 <                // accept
35 >                api::TcpSocket* client(new api::TcpSocket());
36 >
37 >                server.Accept(*client);
38  
39 <                self->handle(); // thread
39 >                api::Thread thread(etl::BindAll(&Daemon::handle, self, client));
40          }
41   }
42  
43 < int Daemon::handle()
43 > int Daemon::handle(api::TcpSocket* client)
44   {
45 +        ios::InputOutputStreamBufAdapter adapter(*client);
46 +        iostream socket(&adapter);
47 +
48          //
49 +
50 +        delete client;
51   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines