diff --git a/Buffer/main.cpp b/Buffer/main.cpp index e74e2406..fb078177 100644 --- a/Buffer/main.cpp +++ b/Buffer/main.cpp @@ -47,7 +47,7 @@ int main( int argc, char * argv[] ) { unsigned char packtype; bool gotVideoInfo = false; bool gotAudioInfo = false; - while(std::cin.good()) { + while(std::cin.good() && std::cout.good()) { loopcount ++; //invalidate the current buffer ringbuf[current_buffer]->number = -1; diff --git a/Connector_HTTP/main.cpp b/Connector_HTTP/main.cpp index 735afe80..fe9d364a 100644 --- a/Connector_HTTP/main.cpp +++ b/Connector_HTTP/main.cpp @@ -16,9 +16,8 @@ int main() { // do something with mySocket... while( std::cin >> input && input != "") {} std::cout << "HTTP/1.1 200 OK\nConnection: close\nContent-Type: video/x-flv\n\n"; - while(true) { + while(std::cout.good()) { msg = mySocket.recv(&buffer[0],10000); - if (!std::cout.good()) { exit(0); } std::cout.write(buffer,msg); } // disconnect diff --git a/Connector_RAW/main.cpp b/Connector_RAW/main.cpp index 54381250..12bb6638 100644 --- a/Connector_RAW/main.cpp +++ b/Connector_RAW/main.cpp @@ -15,9 +15,8 @@ int main() { mySocket.connect(input); char buffer[500000]; int msg; - while(true) { + while(std::cout.good()) { msg = mySocket.recv(&buffer[0],10000); - if (!std::cout.good()) {exit(0);} std::cout.write(buffer,msg); } // disconnect diff --git a/Connector_RTMP/main.cpp b/Connector_RTMP/main.cpp index 98737a81..2e6b3ba9 100644 --- a/Connector_RTMP/main.cpp +++ b/Connector_RTMP/main.cpp @@ -53,7 +53,7 @@ int main(){ #ifdef DEBUG fprintf(stderr, "Starting processing...\n"); #endif - while (!feof(stdin)){ + while (!feof(stdin) && std::cout.good()){ //select(1, &pollset, 0, 0, &timeout); //only parse input from stdin if available or not yet init'ed //FD_ISSET(0, &pollset) || //NOTE: Polling does not work? WHY?!? WHY DAMN IT?!?