libassa
3.5.1
assa
UDPSocket.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// UDPSocket.h
4
//------------------------------------------------------------------------------
5
// Copyright (c) 1999,2006 by Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
// Created: 03/22/99
13
//------------------------------------------------------------------------------
14
#ifndef UDP_SOCKET_H
15
#define UDP_SOCKET_H
16
17
#include "
assa/Socket.h
"
18
19
namespace
ASSA
{
20
28
class
UDPSocket
:
public
Socket
{
29
public
:
31
UDPSocket
()
32
{
33
trace
(
"UDPSocket::UDPSocket()"
);
34
}
35
39
UDPSocket
(
const
handler_t
fd_)
40
{
41
trace
(
"UDPSocket::UDPSocket(fd)"
);
42
m_fd
= fd_;
43
}
44
46
virtual
~UDPSocket
()
47
{
48
trace
(
"UDPSocket::~UDPSocket"
);
49
}
50
58
bool
open
(
const
int
domain_);
59
63
bool
close
();
64
71
bool
bind
(
const
Address
& my_address_);
72
74
handler_t
getHandler
()
const
{
return
m_fd
; }
75
77
const
int
getDomain
()
const
{
return
m_type
; }
78
79
protected
:
81
void
setHandler
(
const
int
fd_) {
m_fd
= fd_; }
82
84
void
setDomain
(
const
int
type_) {
m_type
= type_; }
85
};
86
87
}
// end namespace ASSA
88
89
#endif // UDP_SOCKET_H
90
91
ASSA::UDPSocket::getDomain
const int getDomain() const
Get socket domain type.
Definition:
UDPSocket.h:77
ASSA::UDPSocket
Definition:
UDPSocket.h:28
ASSA::UDPSocket::UDPSocket
UDPSocket()
Default constructor.
Definition:
UDPSocket.h:31
ASSA::UDPSocket::~UDPSocket
virtual ~UDPSocket()
Destructor will close connection.
Definition:
UDPSocket.h:46
handler_t
int handler_t
Definition:
Logger_Impl.h:82
ASSA::UDPSocket::close
bool close()
Close socket connection.
Definition:
UDPSocket.cpp:39
ASSA::UDPSocket::setDomain
void setDomain(const int type_)
Set socket domain type.
Definition:
UDPSocket.h:84
Socket.h
ASSA::Socket::m_fd
handler_t m_fd
File descriptor.
Definition:
Socket.h:485
trace
#define trace(s)
Definition:
Logger.h:429
ASSA::UDPSocket::getHandler
handler_t getHandler() const
Get socket file descriptor.
Definition:
UDPSocket.h:74
ASSA::UDPSocket::setHandler
void setHandler(const int fd_)
Set file descriptor.
Definition:
UDPSocket.h:81
ASSA::UDPSocket::UDPSocket
UDPSocket(const handler_t fd_)
Constructor.
Definition:
UDPSocket.h:39
ASSA::Socket::m_type
int m_type
Socket domain type.
Definition:
Socket.h:488
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::Socket
Definition:
Socket.h:71
ASSA
Definition:
Acceptor.h:40
ASSA::Address
Definition:
Address.h:51
ASSA::UDPSocket::open
bool open(const int domain_)
Create socket.
Definition:
UDPSocket.cpp:22
Generated by
1.8.17