// Version 0.2 // 15 December 2006 #include "UDPserver.h" #include "SocketException.h" UDPserver::UDPserver(int port) { if( !Socket::createWithUDP() ) throw SocketException ("Could not create server socket."); if( !Socket::bind(port) ) throw SocketException ("Could not bind the port."); } UDPserver::~UDPserver(void) { } // poll the socket for messages waiting in the buffer int UDPserver::hasMsg(void) { return Socket::checkBuffer(); } const UDPserver& UDPserver::operator >> ( std::string &msg ) const { if ( ! Socket::recvfrom(msg) ) {//std::cout << "empty buffer~~~~~~~~~~~~\n"; throw SocketException("Could not read from socket."); } return *this; }