diff --git a/Client/main.cpp b/Client/main.cpp index d43f0a3e..2c51e85d 100644 --- a/Client/main.cpp +++ b/Client/main.cpp @@ -6,12 +6,14 @@ int main() { SWUnixSocket mySocket; - mySocket.connect("../socketfile"); - std::string msg; + mySocket.connect("/tmp/socketfile"); + char buffer[500000]; + int msg; // do something with mySocket... + std::cout << "HTTP/1.1 200 OK\nConnection: close\nContent-Type: video/x-flv\n\n"; while(true) { - msg = mySocket.recvmsg(); - std::cout << msg; + msg = mySocket.recv(&buffer[0],10000); + std::cout.write(buffer,msg); } // disconnect mySocket.disconnect(); diff --git a/Server/main.cpp b/Server/main.cpp index 8cc22930..7fbe696f 100644 --- a/Server/main.cpp +++ b/Server/main.cpp @@ -27,11 +27,11 @@ int main() { int position_startframe = 0; int frame_bodylength = 0; SWUnixSocket listener; - SWUnixSocket *mySocket; + SWUnixSocket *mySocket = NULL; SWBaseSocket::SWBaseError BError; cur_header_pos = fread(&header,1,13,stdin); - listener.bind("../socketfile"); + listener.bind("/tmp/socketfile"); listener.listen(); listener.set_timeout(1,0); @@ -42,7 +42,7 @@ int main() { if (!mySocket) { mySocket = (SWUnixSocket *)listener.accept(&BError); if (mySocket) { - mySocket->send(&header[0],cur_header_pos); + mySocket->send(&header[0],13); } } } @@ -63,6 +63,9 @@ int main() { std::cout << "Total message read!\n"; if (mySocket) { mySocket->send(&buffer[0], position_current, &BError); + if ( BError != SWBaseSocket::ok ) { + mySocket = 0; + } } }