source: flair-src/trunk/lib/FlairCore/src/TcpSocket.h@ 238

Last change on this file since 238 was 238, checked in by Bayard Gildas, 4 years ago

correction sémaphore. bloquant tout ça...

File size: 1.6 KB
RevLine 
[2]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]4// %flair:license}
5/*!
6 * \file TcpSocket.h
7 * \brief Class defining a Tcp socket
8 * \author Gildas Bayard, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2015/04/28
10 * \version 4.0
11 */
12
13#ifndef TCPSOCKET_H
14#define TCPSOCKET_H
15
16#include <ConnectedSocket.h>
17
[15]18namespace flair {
19namespace core {
20/*! \class TcpSocket
21*
22* \brief Class encapsulating a TCP socket
23*
24*/
25class TcpSocket : public ConnectedSocket {
26public:
27 TcpSocket(const Object *parent, const std::string name,
28 bool blockOnSend = false, bool blockOnReceive = true);
29 ~TcpSocket();
30 void Listen(const unsigned int port, const std::string localAddress = "ANY");
31 TcpSocket *Accept(
[238]32 Time timeout = TIME_INFINITE);
[15]33 bool Connect(const unsigned int distantPort, const std::string distantAddress,
[238]34 Time timeout = TIME_INFINITE);
35 ssize_t SendMessage(const char *message, size_t message_len, Time timeout = TIME_INFINITE);
36 ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout = TIME_INFINITE);
[2]37
[15]38 uint16_t NetworkToHost16(uint16_t data);
39 uint16_t HostToNetwork16(uint16_t data);
40 uint32_t NetworkToHost32(uint32_t data);
41 uint32_t HostToNetwork32(uint32_t data);
[2]42
[15]43private:
44 int socket; // socket file descriptor
45 bool blockOnSend;
46 bool blockOnReceive;
47 bool isConnected;
[238]48 bool isListening;
[15]49 unsigned int distantPort;
50 std::string distantAddress;
[238]51 char *sendRingBuffer, *recvRingBuffer;
[15]52};
[2]53
54} // end namespace core
55} // end namespace flair
56
57#endif // TCPSOCKET_H
Note: See TracBrowser for help on using the repository browser.