Fawkes API  Fawkes Development Version
datagram.cpp
1 
2 /***************************************************************************
3  * datagram.cpp - Fawkes datagram socket (TCP)
4  *
5  * Created: Fri Nov 10 10:02:54 2006 (on train to Google, Hamburg)
6  * Copyright 2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <netcomm/socket/datagram.h>
25 
26 #include <sys/socket.h>
27 
28 namespace fawkes {
29 
30 /** @class DatagramSocket netcomm/socket/datagram.h
31  * Datagram socket. A UDP socket on top of IP.
32  *
33  * @ingroup NetComm
34  * @author Tim Niemueller
35  */
36 
37 /** Constructor.
38  * @param addr_type Specify IPv4 or IPv6
39  * @param timeout timeout, if 0 all operationsare blocking, otherwise it
40  * is tried for timeout seconds.
41  */
42 DatagramSocket::DatagramSocket(AddrType addr_type, float timeout)
43  : Socket(addr_type, UDP, timeout)
44 {
45 }
46 
47 
48 /** Copy constructor.
49  * @param datagram_socket socket to copy.
50  */
52  : Socket(datagram_socket)
53 {
54 }
55 
56 
57 /** Clone socket.
58  * @return a copied instance of DatagramSocket.
59  */
60 Socket *
62 {
63  return new DatagramSocket(*this);
64 }
65 
66 } // end namespace fawkes
Fawkes library namespace.
AddrType
Address type specification.
Definition: socket.h:78
Socket base class.
Definition: socket.h:65
Datagram socket.
Definition: datagram.h:31
virtual Socket * clone()
Clone socket.
Definition: datagram.cpp:61
DatagramSocket(AddrType addr_type, float timeout=0.f)
Constructor.
Definition: datagram.cpp:42