Last change
on this file since 13 was
13,
checked in by Bayard Gildas, 5 years ago
|
formatting script + include reformatted
|
File size:
1.4 KB
|
Line | |
---|
1 | // %flair:license{ |
---|
2 | // This file is part of the Flair framework distributed under the |
---|
3 | // CECILL-C License, Version 1.0. |
---|
4 | // %flair:license} |
---|
5 | /*! |
---|
6 | * \file UdtSocket.h |
---|
7 | * \brief Class defining a UDT socket |
---|
8 | * \author Gildas Bayard, Copyright Heudiasyc UMR UTC/CNRS 7253 |
---|
9 | * \date 2015/04/21 |
---|
10 | * \version 4.0 |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef UDTSOCKET_H |
---|
14 | #define UDTSOCKET_H |
---|
15 | |
---|
16 | typedef int UDTSOCKET; |
---|
17 | |
---|
18 | #include <ConnectedSocket.h> |
---|
19 | |
---|
20 | namespace flair { |
---|
21 | namespace core { |
---|
22 | /*! \class UdtSocket |
---|
23 | * |
---|
24 | * \brief Class encapsulating a UDT socket |
---|
25 | * |
---|
26 | */ |
---|
27 | class UdtSocket : public ConnectedSocket { |
---|
28 | public: |
---|
29 | UdtSocket(const Object *parent, const std::string name, |
---|
30 | bool blockOnSend = false, bool blockOnReceive = true); |
---|
31 | ~UdtSocket(); |
---|
32 | void Listen(const unsigned int port, const std::string localAddress = "ANY"); |
---|
33 | UdtSocket * |
---|
34 | Accept(Time timeout); // should throw an exception if not a listening socket |
---|
35 | bool Connect(const unsigned int port, const std::string distantAddress, |
---|
36 | Time timeout); // /!\ timeout is ignored |
---|
37 | ssize_t SendMessage(const char *message, size_t message_len, Time timeout); |
---|
38 | ssize_t RecvMessage(char *buf, size_t buf_len, Time timeout); |
---|
39 | |
---|
40 | uint16_t NetworkToHost16(uint16_t data); |
---|
41 | uint16_t HostToNetwork16(uint16_t data); |
---|
42 | uint32_t NetworkToHost32(uint32_t data); |
---|
43 | uint32_t HostToNetwork32(uint32_t data); |
---|
44 | |
---|
45 | private: |
---|
46 | UDTSOCKET socket; |
---|
47 | bool blockOnSend; |
---|
48 | bool blockOnReceive; |
---|
49 | }; |
---|
50 | |
---|
51 | } // end namespace core |
---|
52 | } // end namespace flair |
---|
53 | |
---|
54 | #endif // UDTSOCKET_H |
---|
Note: See
TracBrowser
for help on using the repository browser.