#ifndef n_UdpSender_H
#define n_UdpSender_H

/*
 *
 * nucleo/network/udp/UdpSender.H --
 *
 * Copyright (C) Nicolas Roussel
 *
 * See the file LICENSE for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

namespace nucleo {

  class UdpSender {

  private:

    int _fd ;
    struct sockaddr_in _peer ;

  public:

    UdpSender(const char *hostname, int port) ;

    // 1=subnet, 31=site, 64=national, 127 and more=worldwide
    void setMulticastTTL(unsigned int ttl) ;

    // returns the number of bytes sent
    int send(const void *content, unsigned int contentLength) ;
  
    ~UdpSender(void) ;

  } ;

}

#endif
