Back to index

texmacs  1.0.7.15
socket_server.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : socket_server.cpp
00004 * DESCRIPTION: TeXmacs servers over sockets
00005 * COPYRIGHT  : (C) 2007  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef SOCKET_SERVER_H
00013 #define SOCKET_SERVER_H
00014 #include "tm_link.hpp"
00015 #include "socket_notifier.hpp"
00016 
00017 /******************************************************************************
00018 * The socket_server class
00019 ******************************************************************************/
00020 
00021 struct socket_server_rep: tm_link_rep {
00022   int port;                 // port for the socket
00023   int server;               // listening socket descriptor
00024   array<tm_link> incoming;  // list of clients
00025 
00026   socket_notifier sn;
00027   
00028 public:
00029   socket_server_rep (int port);
00030   ~socket_server_rep ();
00031 
00032   string  start ();
00033   void    write (string s, int channel);
00034   string& watch (int channel);
00035   string  read (int channel);
00036   void    listen (int msecs);
00037   void    interrupt ();
00038   void    stop ();
00039 
00040   void    start_client ();
00041 };
00042 
00043 #endif // SOCKET_SERVER_H