--- projects/cms/source/host/c++/SubNet.cpp 2001/03/05 14:02:27 1.1 +++ projects/cms/source/host/c++/SubNet.cpp 2001/03/23 14:09:57 1.3 @@ -1,5 +1,12 @@ #include "SubNet.h" +SubNet::~SubNet(){ + + delete socket; + delete udp; + +} // ~SubNet + SubNet::SubNet(string host, int port){ // constructor @@ -28,11 +35,12 @@ SubNet::SubNet(){ string SubNet::sendTCP(string text){ - char buf[1024]; + int size = 8192; + char buf[size]; (*socket) << text.c_str() << "\n" << flush; // - (*socket).getline (buf, 1024); + (*socket).getline (buf, size-1); return buf; @@ -41,21 +49,14 @@ string SubNet::sendTCP(string text){ void SubNet::sendUPDPacket( string host, int port, string message ){ - /* - host = "raptor.ukc.ac.uk"; - port = 7776; - */ + int udpSize; + udpSize = 8129; // 8kb in bits (8192*8) - int udpSize; - udpSize = 65536; // 8kb in bits (8192*8) - udp = new osockinet(sockbuf::sock_dgram); (*udp)->setopt(sockbuf::so_sndbuf , &udpSize, sizeof(udpSize), sockbuf::sol_socket); - // int sndBufSize = (*udp)->sendbufsz(udpSize); - - (*udp)->connect (host.c_str(), port); - (*udp) << message.c_str() << endl; + (*udp)->connect (host.c_str(), port); + (*udp) << message.c_str() << flush; delete udp;