Action_Thermostats
Add_AtomRandomPerturbation
Add_RotateAroundBondAction
Add_SelectAtomByNameAction
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
Automaking_mpqc_open
AutomationFragmentation_failures
Candidate_v1.6.0
Candidate_v1.6.1
ChangeBugEmailaddress
ChangingTestPorts
ChemicalSpaceEvaluator
Combining_Subpackages
Debian_Package_split
Debian_package_split_molecuildergui_only
Disabling_MemDebug
Docu_Python_wait
EmpiricalPotential_contain_HomologyGraph_documentation
Enable_parallel_make_install
Enhance_userguide
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Example_ManyWaysToTranslateAtom
Exclude_Hydrogens_annealWithBondGraph
FitPartialCharges_GlobalError
Fix_ChronosMutex
Fix_StatusMsg
Fix_StepWorldTime_single_argument
Fix_Verbose_Codepatterns
ForceAnnealing_goodresults
ForceAnnealing_oldresults
ForceAnnealing_tocheck
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
GeometryObjects
Gui_displays_atomic_force_velocity
IndependentFragmentGrids_IntegrationTest
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
JobMarket_unresolvable_hostname_fix
ODR_violation_mpqc_open
PartialCharges_OrthogonalSummation
PythonUI_with_named_parameters
QtGui_reactivate_TimeChanged_changes
Recreated_GuiChecks
RotateToPrincipalAxisSystem_UndoRedo
StoppableMakroAction
Subpackage_levmar
Subpackage_mpqc_open
Subpackage_vmg
ThirdParty_MPQC_rebuilt_buildsystem
TremoloParser_IncreasedPrecision
TremoloParser_MultipleTimesteps
Ubuntu_1604_changes
stable
Line | |
---|
1 | #ifdef __GNUG__
|
---|
2 | #pragma interface
|
---|
3 | #endif
|
---|
4 |
|
---|
5 | #ifndef _socket_h
|
---|
6 | #define _socket_h
|
---|
7 |
|
---|
8 | #include <unistd.h>
|
---|
9 | #include <sys/types.h>
|
---|
10 |
|
---|
11 | #include <string>
|
---|
12 |
|
---|
13 | class TCPSocket {
|
---|
14 | protected:
|
---|
15 | TCPSocket();
|
---|
16 | virtual ~TCPSocket();
|
---|
17 |
|
---|
18 | int socket_;
|
---|
19 | int port_;
|
---|
20 | bool initialized_;
|
---|
21 | bool bound_;
|
---|
22 |
|
---|
23 | public:
|
---|
24 | void create();
|
---|
25 | void bind(u_int16_t port_begin, u_int16_t port_fence);
|
---|
26 | int port() { return port_; }
|
---|
27 | u_int32_t addr();
|
---|
28 |
|
---|
29 | bool initialized() { return initialized_; }
|
---|
30 | bool bound() { return bound_; }
|
---|
31 |
|
---|
32 | virtual void close();
|
---|
33 | };
|
---|
34 |
|
---|
35 | class TCPIOSocket: public TCPSocket {
|
---|
36 | public:
|
---|
37 | int read(void *d, int n);
|
---|
38 | int write(const void *d, int n);
|
---|
39 | int read_int(int *d, int n) {return read((void*)d,n*sizeof(int));}
|
---|
40 | int write_int(const int *d, int n) {return write((void*)d,n*sizeof(int));}
|
---|
41 | int read_string(std::string &);
|
---|
42 | int write_string(const std::string &);
|
---|
43 | int read_int(int &);
|
---|
44 | int write_int(int);
|
---|
45 | int read_uint32(u_int32_t &);
|
---|
46 | int write_uint32(u_int32_t);
|
---|
47 | };
|
---|
48 |
|
---|
49 | class TCPServerSocket: public TCPSocket {
|
---|
50 | friend class TCPServerConnection;
|
---|
51 | public:
|
---|
52 | void listen(int queue_length = 8);
|
---|
53 | };
|
---|
54 |
|
---|
55 | class TCPServerConnection: public TCPIOSocket {
|
---|
56 | public:
|
---|
57 | void accept(const TCPServerSocket &);
|
---|
58 | };
|
---|
59 |
|
---|
60 | class TCPClientConnection: public TCPIOSocket {
|
---|
61 | bool connected_;
|
---|
62 | public:
|
---|
63 | TCPClientConnection();
|
---|
64 | void close();
|
---|
65 | bool connected() { return connected_; }
|
---|
66 | void connect(const char *remote_hostname, u_int16_t remote_port);
|
---|
67 | void connect(u_int32_t remote_host, u_int16_t remote_port);
|
---|
68 | };
|
---|
69 |
|
---|
70 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.