tcp.h
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #ifndef TCP_H_
15 #define TCP_H_
16 
17 #include "charinterface.h"
18 
19 #if defined __linux__ || defined __APPLE__
20  #define TCP_SOCKET
21 #endif //__linux__ || LINUX
22 
23 #if defined WINDOWS || defined __WIN32__ || defined _WIN32
24  #define TCP_SOCKET
25 #endif // WINDOWS || __WIN32__ || defined _WIN32
26 
27 #if defined TCP_SOCKET
28  #define USE_TCP
29 #endif
30 
31 #ifdef TCP_SOCKET
32 class XTCPSocketPort : public XPort {
33 public:
34  XTCPSocketPort(XCharInterface *interface);
35  virtual ~XTCPSocketPort();
36 
37  virtual void open(const XCharInterface *pInterface) throw (XInterface::XCommError &);
38  virtual void send(const char *str) throw (XInterface::XCommError &);
39  virtual void write(const char *sendbuf, int size) throw (XInterface::XCommError &);
40  virtual void receive() throw (XInterface::XCommError &);
41  virtual void receive(unsigned int length) throw (XInterface::XCommError &);
42 private:
43  void reopen_socket() throw (XInterface::XCommError &);
44  int m_socket;
45 };
46 
47 typedef XTCPSocketPort XTCPPort;
48 
49 #endif // TCP_SOCKET
50 
51 #endif /*TCP_H_*/

Generated for KAME4 by  doxygen 1.8.3