Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 timeout timeout, if 0 all operationsare blocking, otherwise it
39  * is tried for timeout seconds.
40  */
42  : Socket(PF_INET, SOCK_DGRAM, 0, timeout)
43 {
44 }
45 
46 
47 /** Copy constructor.
48  * @param datagram_socket socket to copy.
49  */
51  : Socket(datagram_socket)
52 {
53 }
54 
55 
56 /** Clone socket.
57  * @return a copied instance of DatagramSocket.
58  */
59 Socket *
61 {
62  return new DatagramSocket(*this);
63 }
64 
65 } // end namespace fawkes