ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/SmallNet.cpp
(Generate patch)

Comparing projects/cms/source/host/c++/SmallNet.cpp (file contents):
Revision 1.4 by ab11, Mon Mar 5 12:39:43 2001 UTC vs.
Revision 1.6 by tdb, Sat May 18 18:15:56 2002 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines