UdpServer.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 $Header$
00004 
00005 */
00006 
00007 #include <stdio.h>
00008 #include <unistd.h>
00009 #include <fcntl.h>
00010 
00011 #include "Error.h"
00012 
00013 #include "UdpServer.h"
00014 
00015 // Public methods.
00016 
00017 UdpServer::UdpServer(const String &bindAddress, const String &service) : UdpConnection(bindAddress, service)
00018 {
00019   int t = 1;
00020 
00021   if (setsockopt(_socket, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(t))) {
00022     failure(ERROR(MSG_SOCKET_CANNOT_SET_OPTION, strerror(errno)));
00023     return;
00024   }
00025 
00026   if (bind(_socket, (struct sockaddr *)&(_local), sizeof(_local))) {
00027     failure(ERROR(MSG_SOCKET_CANNOT_BIND, strerror(errno)));
00028     return;
00029   }
00030 }
00031 
00032 UdpServer::~UdpServer()
00033 {
00034 }

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1