Ignore:
Timestamp:
05/28/10 09:25:33 (14 years ago)
Author:
ogrimm
Message:
Adapted to new name of message service
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/SkyQualityMonitor/sqm.cpp

    r179 r217  
    33  Interface to the sky quality monitor (essentially a socket interface)
    44 
    5   Terminate with CTRL-c. Note that socket is closed automatically by exit().
     5  Terminate with CTRL-c. Socket is closed automatically by exit().
    66 
    77  Oliver Grimm, September 2009
     
    3939  // Open socket descriptor
    4040  if ((SocketDescriptor = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
    41     Srv.State(Srv.FATAL, "Could not open socket (%s)", strerror(errno));
     41    Srv.Message(Srv.FATAL, "Could not open socket (%s)", strerror(errno));
    4242  }
    4343   
     
    4545  struct hostent *hostent = gethostbyname(Address);
    4646  if (hostent==0) {
    47     Srv.State(Srv.FATAL, "Could not resolve host name '%s' (%s)", Address, hstrerror(h_errno));
     47    Srv.Message(Srv.FATAL, "Could not resolve host name '%s' (%s)", Address, hstrerror(h_errno));
    4848  }
    4949
     
    5454 
    5555  if (connect(SocketDescriptor, (struct sockaddr *) &SocketAddress, sizeof(SocketAddress))==-1) {
    56     Srv.State(Srv.FATAL, "Could not connect to server '%s' on port %d (%s)", Address, Port, strerror(errno));
     56    Srv.Message(Srv.FATAL, "Could not connect to server '%s' on port %d (%s)", Address, Port, strerror(errno));
    5757  }
    5858
    59   Srv.State(Srv.INFO, "Connected to server '%s' on port %d", Address, Port);
     59  Srv.Message(Srv.INFO, "Connected to server '%s' on port %d", Address, Port);
    6060  signal(SIGPIPE,SIG_IGN);  // Do not kill process if writing to closed socket
    6161
     
    7373    // Write read command to socket
    7474    if ((write(SocketDescriptor, READ_CMD, strlen(READ_CMD)))<1) {
    75       Srv.State(Srv.ERROR, "Could not write read command '%s' to socket.", READ_CMD);
     75      Srv.Message(Srv.ERROR, "Could not write read command '%s' to socket.", READ_CMD);
    7676    }
    7777   
     
    8282    struct timeval WaitTime = {Period, 0};
    8383    if (select(((int) SocketDescriptor)+1, &ReadFileDescriptor, NULL, NULL, &WaitTime)==-1) {
    84       Srv.State(Srv.FATAL, "Error with select() (%s)", strerror(errno));
     84      Srv.Message(Srv.FATAL, "Error with select() (%s)", strerror(errno));
    8585    }
    8686
    8787    if (!FD_ISSET(SocketDescriptor, &ReadFileDescriptor)) {
    88       Srv.State(Srv.WARN, "Time-out of %d seconds expired before receiving response from socket", Period);
     88      Srv.Message(Srv.WARN, "Time-out of %d seconds expired before receiving response from socket", Period);
    8989      continue;
    9090    }
     
    9292    memset(Buffer, 0, BUF_SIZE);
    9393    if(read(SocketDescriptor, Buffer, BUF_SIZE) == 0) {
    94       Srv.State(Srv.FATAL, "Server not existing anymore, exiting...\n");
     94      Srv.Message(Srv.FATAL, "Server not existing anymore, exiting...\n");
    9595    }
    9696
Note: See TracChangeset for help on using the changeset viewer.