00001 /* First VOS tutorial. The simplest possible program that uses VOS. 00002 00003 This tutorial covers: 00004 - Creating a site for the application to use 00005 - The VOS run loop 00006 00007 This file (vostut1.cc) is released into the public domain. No 00008 restrictions are placed on its use, distribution or inclusion into 00009 other works. 00010 */ 00011 00012 /* This header brings in all the declarations needed to use the core 00013 VOS library. */ 00014 00015 #include <vos/corelibs/vos/vos.hh> 00016 00017 int main(int argc, char** argv) 00018 { 00019 cout << "VOS Tutorial 1\n\n"; 00020 00021 /* Create a local site which can communicate over TCP/IP sockets. 00022 A "site" is a required part of any VOS application. Its 00023 responsibility is to represent this application to other sites 00024 on the network. Once this site is constructed, it will be 00025 accessible by connecting the port which it opened (the default 00026 port number is 4231). When we create the site, we must supply 00027 an access control policy. This is used to determine if a 00028 read/write operation is allowed on this site. For this 00029 tutorial we are using a totally insecure policy which allows 00030 anyone to do anything. */ 00031 00032 LocalSocketSite localsite(&NoAccessControl::static_); 00033 00034 /* We need to call the flushIncomingBuffers() method periodically 00035 so that the site can process incoming data from the network and 00036 perform any other pending VOS tasks. In this case we don't 00037 have anything else to do, so we just call it forever. */ 00038 00039 while(true) { 00040 localsite.flushIncomingBuffers(); 00041 } 00042 }