Main MRPT website > C++ reference for MRPT 1.9.9
CServerTCPSocket_LIN.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "comms-precomp.h" // Precompiled headers
11 
12 #include <mrpt/config.h>
13 
14 #if defined(MRPT_OS_LINUX) || defined(MRPT_OS_APPLE)
15 
18 #include <mrpt/system.h>
19 
20 // Platform specific headers:
21 #include <sys/socket.h>
22 #include <unistd.h>
23 #include <fcntl.h>
24 #include <errno.h>
25 //#include <iostream>
26 #include <sys/types.h>
27 #include <sys/ioctl.h>
28 #include <netdb.h>
29 #include <arpa/inet.h>
30 #include <netinet/in.h>
31 #include <sys/socket.h>
32 
33 using namespace mrpt;
34 using namespace mrpt::utils;
35 using namespace mrpt::comms;
36 
37 /*---------------------------------------------------------------
38  Constructor
39  ---------------------------------------------------------------*/
40 CServerTCPSocket::CServerTCPSocket(
41  unsigned short listenPort, const std::string& IPaddress,
42  int maxConnectionsWaiting, mrpt::utils::VerbosityLevel verbosityLevel)
43  : COutputLogger("CServerTCPSocket")
44 {
46  setVerbosityLevel(verbosityLevel);
47  setupSocket(listenPort, IPaddress, maxConnectionsWaiting);
49 }
50 
51 /*---------------------------------------------------------------
52  Destructor
53  ---------------------------------------------------------------*/
55 {
56  // Delete socket:
57  if (m_serverSock != -1) close(m_serverSock);
58 }
59 
60 #endif // Linux
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
virtual ~CServerTCPSocket()
Dtor.
#define MRPT_TRY_END
void setupSocket(unsigned short listenPort, const std::string &IPaddress, int maxConnectionsWaiting)
Common code called from the platform-dependant constructor.
GLsizei const GLchar ** string
Definition: glext.h:4101
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int m_serverSock
The handle for the listening server TCP socket.
#define MRPT_TRY_START
Serial and networking devices and utilities.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019