ConnectedUNDatagramSocketHandle.cc
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
18 
19 // Custom includes
20 #include <sys/socket.h>
21 #include <sys/types.h>
22 #include <sys/ioctl.h>
23 
24 #include <senf/Utils/Exception.hh>
25 
26 //#include "UNDatagramSocketHandle.mpp"
27 #define prefix_
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 
31 {
32  int sock = ::socket(PF_UNIX, SOCK_DGRAM, 0);
33  if (sock < 0)
34  SENF_THROW_SYSTEM_EXCEPTION("Could not create socket(PF_UNIX,SOCK_DGRAM,0).");
35  fd(sock);
36 }
37 
39 {
40  init_client();
41  clientHandle().connect(address);
42 }
43 
44 //-/////////////////////////////////////////////////////////////////////////////////////////////////
45 #undef prefix_
46 //#include "UNDatagramSocketHandle.mpp"
47 
48 
49 // Local Variables:
50 // mode: c++
51 // fill-column: 100
52 // comment-column: 40
53 // c-file-style: "senf"
54 // indent-tabs-mode: nil
55 // ispell-local-dictionary: "american"
56 // compile-command: "scons -u test"
57 // End:
ClientSocketHandle< Policy > clientHandle() const
Get client handle for associated socket.
#define SENF_THROW_SYSTEM_EXCEPTION(desc)
Unix domain socket address.
Definition: UNAddressing.hh:41
int fd() const
Get file descriptor.
ConnectedUNDatagramSocketHandle public header.
void init_client() const
Create unconnected client socket.