Loading...
Searching...
No Matches
UDPSocket.h
Go to the documentation of this file.
// -*- c++ -*-
//------------------------------------------------------------------------------
// UDPSocket.h
//------------------------------------------------------------------------------
// Copyright (c) 1999,2006 by Vladislav Grinchenko
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------------
// Created: 03/22/99
//------------------------------------------------------------------------------
#ifndef UDP_SOCKET_H
#define UDP_SOCKET_H
#include "assa/Socket.h"
namespace ASSA {
class UDPSocket : public Socket {
public:
UDPSocket ()
{
trace("UDPSocket::UDPSocket()");
}
UDPSocket (const handler_t fd_)
{
trace("UDPSocket::UDPSocket(fd)");
m_fd = fd_;
}
virtual ~UDPSocket ()
{
trace("UDPSocket::~UDPSocket");
}
bool open (const int domain_);
bool close ();
bool bind (const Address& my_address_);
handler_t getHandler() const { return m_fd; }
const int getDomain() const { return m_type; }
protected:
void setHandler(const int fd_) { m_fd = fd_; }
void setDomain(const int type_) { m_type = type_; }
};
} // end namespace ASSA
#endif // UDP_SOCKET_H
trace
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition Logger.h:429
Socket.h
Abstraction of socket data type.
ASSA::Address
Definition Address.h:51
ASSA::AutoPtrRef
A wrapper class to provide AutoPtr with reference semantics.
Definition AutoPtr.h:32
ASSA::Socket
Definition Socket.h:71
ASSA::Socket::m_type
int m_type
Socket domain type.
Definition Socket.h:488
ASSA::Socket::m_fd
handler_t m_fd
File descriptor.
Definition Socket.h:485
ASSA::UDPSocket
Definition UDPSocket.h:28
ASSA::UDPSocket::getDomain
const int getDomain() const
Get socket domain type.
Definition UDPSocket.h:77
ASSA::UDPSocket::setHandler
void setHandler(const int fd_)
Set file descriptor.
Definition UDPSocket.h:81
ASSA::UDPSocket::getHandler
handler_t getHandler() const
Get socket file descriptor.
Definition UDPSocket.h:74
ASSA::UDPSocket::UDPSocket
UDPSocket()
Default constructor.
Definition UDPSocket.h:31
ASSA::UDPSocket::UDPSocket
UDPSocket(const handler_t fd_)
Constructor.
Definition UDPSocket.h:39
ASSA::UDPSocket::~UDPSocket
virtual ~UDPSocket()
Destructor will close connection.
Definition UDPSocket.h:46
ASSA::UDPSocket::open
bool open(const int domain_)
Create socket.
Definition UDPSocket.cpp:22
ASSA::UDPSocket::bind
bool bind(const Address &my_address_)
Server in UDP client-server scenario has to bind socket to its local well-known port.
Definition UDPSocket.cpp:52
ASSA::UDPSocket::setDomain
void setDomain(const int type_)
Set socket domain type.
Definition UDPSocket.h:84
ASSA::UDPSocket::close
bool close()
Close socket connection.
Definition UDPSocket.cpp:39
ASSA
Definition Acceptor.h:40