Hello!
I am writing an application that should be able to receive html-pages. But i have some problems to receive the sides. IT seems if i could successfully connect to the host and open a stream socket that is listening on port 80. when i send the command "GET /" to the server it seems if it arrives successfully but when i try to receive the incomming data i get the errorcode WSAECONNRESET.
I don´t know how to find the error, because i don´t know if the preceding connection was successfully. How can i figured it out. Is there a possibility. I started my firewall that tells me that my application wants to connect to the server. But why i am not abel to recv the data. Here is my piece of code....
Thanks in advanceCode:int Socket::recv_all( std::string& s )
{
std::string::iterator at = s.begin();
int received; //Bytes send
fd_set master;
FD_ZERO( &master ); //Set fd_set to NULL
FD_SET( fdscp, &master ); //Adds discriptor to fd_set
char buffer[255];
int res = select( fdscp+1, &master, NULL, NULL, NULL );
if ( res == SOCKET_ERROR )
throw SocketException( "Select: SOCKET_ERROR" );
if ( FD_ISSET( fdscp, &master ) )
{
received = recv( fdscp, buffer, 255/*at, DATASIZE*/, 0 );
if ( !received )
throw SocketException( "Connection was closed" );
if ( received == SOCKET_ERROR )
throw SocketException( "SocketError in recv_all" );
if ( received == WSAEMSGSIZE )
throw SocketException( "Message larger as buffer" );
std::cout << buffer ;
}
return received;
}
