Back to index

texmacs  1.0.7.15
Functions | Variables
socket_server.cpp File Reference
#include "socket_server.hpp"
#include "sys_utils.hpp"
#include "hashset.hpp"
#include "iterator.hpp"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/wait.h>

Go to the source code of this file.

Functions

void socket_server_callback (void *obj, void *info)
tm_link make_socket_server (int port)
int number_of_servers ()
void close_all_servers ()

Variables

hashset< pointersocket_server_set

Function Documentation

Definition at line 57 of file socket_server.cpp.

                     {
#ifndef __MINGW32__
  iterator<pointer> it= iterate (socket_server_set);
  while (it->busy()) {
    socket_server_rep* ss= (socket_server_rep*) it->next();
    if (ss->alive) {
      // FIXME: cleanly close the connection to the socket here
      ss->alive= false;
    }
  }
#endif
}

Here is the call graph for this function:

tm_link make_socket_server ( int  port)

Definition at line 47 of file socket_server.cpp.

                              {
  return tm_new<socket_server_rep> (port);
}

Definition at line 52 of file socket_server.cpp.

                     {
  return N (socket_server_set);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void socket_server_callback ( void *  obj,
void *  info 
)

Definition at line 176 of file socket_server.cpp.

                                               {
#ifndef __MINGW32__
  (void) info;
  socket_server_rep* ss = (socket_server_rep*) obj;
  bool busy= true;
  bool news= false;
  while (busy) {
    fd_set rfds;
    FD_ZERO (&rfds);
    int max_fd= ss->server + 1;
    FD_SET (ss->server, &rfds);
  
    struct timeval tv;
    tv.tv_sec  = 0;
    tv.tv_usec = 0;
    select (max_fd, &rfds, NULL, NULL, &tv);

    busy= false;
    if (ss->alive && FD_ISSET (ss->server, &rfds)) {
      //cout << "server_callback" << LF;
      ss->start_client ();
      busy= news= true;
    }
  }
  
  if (!is_nil (ss->feed_cmd) && news)
    ss->feed_cmd->apply (); // call the data processor
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 26 of file socket_server.cpp.