ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/SmallNet.cpp
Revision: 1.5
Committed: Tue Mar 27 00:05:08 2001 UTC (23 years, 8 months ago) by ab11
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Changes since 1.4: +14 -42 lines
Log Message:
tidied up

File Contents

# Content
1 #include "SmallNet.h"
2
3 SmallNet::SmallNet(int printDebug){
4
5 debug = printDebug;
6
7 if ( debug == 1 ){
8 std::cout << "SmallNet Constructor\n";
9 } // if
10
11 return;
12
13 } // SmallNet
14
15
16 int SmallNet::connectHeartBeat(string host, int port){
17
18 if ( debug == 1 ){
19 std::cout << "SmallNet::connectHeartBeat(" << host << "," << port << ")\n";
20 } // if
21
22 ssocket = new SubNet(host, port);
23
24 return ssocket->isConnected();
25
26 } // connectHeartBeat
27
28 string SmallNet::heartBeatSend(string text){
29
30 if ( debug == 1 ){
31 std::cout << "SmallNet::heartBeatSend()\n";
32 } // if
33
34 return ssocket->sendTCP(text);
35
36 } // heartBeatSend
37
38
39 void SmallNet::closeHeartBeatConnection(){
40 if ( debug == 1 ){
41 std::cout << "SmallNet::closeHeartBeatConnection()\n";
42 std::cout << "Deleting socket\n";
43 } // if
44
45 // closes automatically
46 delete ssocket;
47 return;
48
49 } // closeHeartBeatConnection
50
51
52 int SmallNet::connectConfig(string host, int port){
53 if ( debug == 1 ){
54 std::cout << "SmallNet::connectConfig(" << host << "," << port << ")\n";
55 } // if
56
57 return connectHeartBeat(host,port);
58
59 } // makeConfigConnection
60
61 string SmallNet::configSend(string text){
62 if ( debug == 1 ){
63 std::cout << "SmallNet::configSend()\n";
64 } // if
65
66 return heartBeatSend(text);
67
68 } // configSend
69
70 void SmallNet::closeConfigConnection(){
71 if ( debug == 1 ){
72 std::cout << "SmallNet::closeConfigConnection()\n";
73 } // if
74
75 closeHeartBeatConnection();
76
77 return;
78
79 } // closeConfigConnection
80
81 void SmallNet::sendUPDPacket( string host, int port, string message ){
82
83 if ( debug == 1 ){
84 std::cout << "SmallNet::sendUPDPacket:" << host << ":" << port << "\n";
85 } // if
86
87 ssocket = new SubNet();
88 ssocket->sendUPDPacket(host, port, message);
89 delete ssocket;
90
91 return;
92 } // sendUDPPacket