Debian Codegraph @

CodeLite/SocketAPI/clSocketServer.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2014 Eran Ifrah
5 // file name : clSocketServer.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25
26 #ifndef CLSOCKETSERVER_H
27 #define CLSOCKETSERVER_H
28
29 #include "clSocketBase.h"
30 #include "codelite_exports.h"
31
32 class WXDLLIMPEXP_CL clSocketServer : public clSocketBase
33 {
34 public:
35 clSocketServer();
36 virtual ~clSocketServer();
37
38 protected:
39 /**
40 * @brief On Windows, the 'pipePath' is a string containing the port number.
41 * LocalSocket is implemented under Windows with TCP/IP with IP always set to 127.0.0.1
42 * @param pipePath
43 * @throw clSocketException
44 */
45 int CreateServer(const std::string& pipePath);
46 /**
47 * @throw clSocketException
48 * @return port number
49 */
50 int CreateServer(const std::string& address, int port);
51
52 public:
53 /**
54 * @brief Create server using connection string
55 * @return port number on success
56 * @throw clSocketException
57 */
58 int Start(const wxString& connectionString);
59 clSocketBase::Ptr_t WaitForNewConnection(long timeout = -1);
60 /**
61 * @brief same as above, however, return a pointer to the connection that should be freed by the caller
62 */
63 clSocketBase* WaitForNewConnectionRaw(long timeout = -1);
64 };
65
66 #endif // CLSOCKETSERVER_H