ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/SmallNet.cpp
Revision: 1.8
Committed: Mon Jun 10 14:10:43 2002 UTC (22 years, 5 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +0 -0 lines
State: FILE REMOVED
Log Message:
Tidy up of files. These are all old things that are not only no longer used
but are also probably useless to anyone other than us. This saves checking
them out all the time, and makes the "cms/source" tree contain only current
stuff. They'll still exist in the attic's though :)

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * http://www.i-scream.org.uk
4 * Copyright (C) 2000-2002 i-scream
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 #include "SmallNet.h"
22
23 SmallNet::SmallNet(int printDebug){
24
25 debug = printDebug;
26
27 if ( debug == 1 ){
28 std::cout << "SmallNet Constructor\n";
29 } // if
30
31 return;
32
33 } // SmallNet
34
35
36 int SmallNet::connectHeartBeat(string host, int port){
37
38 if ( debug == 1 ){
39 std::cout << "SmallNet::connectHeartBeat(" << host << "," << port << ")\n";
40 } // if
41
42 ssocket = new SubNet(host, port);
43
44 return ssocket->isConnected();
45
46 } // connectHeartBeat
47
48 string SmallNet::heartBeatSend(string text){
49
50 if ( debug == 1 ){
51 std::cout << "SmallNet::heartBeatSend()\n";
52 } // if
53
54 return ssocket->sendTCP(text);
55
56 } // heartBeatSend
57
58
59 void SmallNet::closeHeartBeatConnection(){
60 if ( debug == 1 ){
61 std::cout << "SmallNet::closeHeartBeatConnection()\n";
62 std::cout << "Deleting socket\n";
63 } // if
64
65 // closes automatically
66 delete ssocket;
67 return;
68
69 } // closeHeartBeatConnection
70
71
72 int SmallNet::connectConfig(string host, int port){
73 if ( debug == 1 ){
74 std::cout << "SmallNet::connectConfig(" << host << "," << port << ")\n";
75 } // if
76
77 return connectHeartBeat(host,port);
78
79 } // makeConfigConnection
80
81 string SmallNet::configSend(string text){
82 if ( debug == 1 ){
83 std::cout << "SmallNet::configSend()\n";
84 } // if
85
86 return heartBeatSend(text);
87
88 } // configSend
89
90 void SmallNet::closeConfigConnection(){
91 if ( debug == 1 ){
92 std::cout << "SmallNet::closeConfigConnection()\n";
93 } // if
94
95 closeHeartBeatConnection();
96
97 return;
98
99 } // closeConfigConnection
100
101 void SmallNet::sendUPDPacket( string host, int port, string message ){
102
103 if ( debug == 1 ){
104 std::cout << "SmallNet::sendUPDPacket:" << host << ":" << port << "\n";
105 } // if
106
107 ssocket = new SubNet();
108 ssocket->sendUPDPacket(host, port, message);
109 delete ssocket;
110
111 return;
112 } // sendUDPPacket