Fix voor xinetd problemen?

This commit is contained in:
Thulinma 2010-11-04 22:08:33 +01:00
parent 309f727f62
commit ceeef9b29e
4 changed files with 4 additions and 6 deletions

View file

@ -47,7 +47,7 @@ int main( int argc, char * argv[] ) {
unsigned char packtype; unsigned char packtype;
bool gotVideoInfo = false; bool gotVideoInfo = false;
bool gotAudioInfo = false; bool gotAudioInfo = false;
while(std::cin.good()) { while(std::cin.good() && std::cout.good()) {
loopcount ++; loopcount ++;
//invalidate the current buffer //invalidate the current buffer
ringbuf[current_buffer]->number = -1; ringbuf[current_buffer]->number = -1;

View file

@ -16,9 +16,8 @@ int main() {
// do something with mySocket... // do something with mySocket...
while( std::cin >> input && input != "") {} while( std::cin >> input && input != "") {}
std::cout << "HTTP/1.1 200 OK\nConnection: close\nContent-Type: video/x-flv\n\n"; 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); msg = mySocket.recv(&buffer[0],10000);
if (!std::cout.good()) { exit(0); }
std::cout.write(buffer,msg); std::cout.write(buffer,msg);
} }
// disconnect // disconnect

View file

@ -15,9 +15,8 @@ int main() {
mySocket.connect(input); mySocket.connect(input);
char buffer[500000]; char buffer[500000];
int msg; int msg;
while(true) { while(std::cout.good()) {
msg = mySocket.recv(&buffer[0],10000); msg = mySocket.recv(&buffer[0],10000);
if (!std::cout.good()) {exit(0);}
std::cout.write(buffer,msg); std::cout.write(buffer,msg);
} }
// disconnect // disconnect

View file

@ -53,7 +53,7 @@ int main(){
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "Starting processing...\n"); fprintf(stderr, "Starting processing...\n");
#endif #endif
while (!feof(stdin)){ while (!feof(stdin) && std::cout.good()){
//select(1, &pollset, 0, 0, &timeout); //select(1, &pollset, 0, 0, &timeout);
//only parse input from stdin if available or not yet init'ed //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?!? //FD_ISSET(0, &pollset) || //NOTE: Polling does not work? WHY?!? WHY DAMN IT?!?