[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
TCPStream exceptions
From: |
Łukasz Michalski |
Subject: |
TCPStream exceptions |
Date: |
Thu, 31 Jan 2002 09:18:33 +0100 |
Hi,
I am trying to use TCPStream class for my project and encoutered problems
with exceptions. When I create TCPStream object to non-existant host I get
some exception but I cant figure out what type of exception it is. I've
tried to turn off exception throwing by passing false to TCPStream
constructor but it doesn't help. Something is still thrown.
Slackware 8.0 with gcc upgarded to version 3.0.3
CommonC++ 1.9.4 configured with './configure'
Here is sample program:
#include <iostream>
#include <stdlib.h>
#include <cc++/socket.h>
#include <stdexcept>
using namespace std;
int main(int argc, char *argv[])
{
try {
ost::InetHostAddress target("10.10.1.2"); //no route to this
host on my
system
ost::TCPStream tcp(target,9999,false,500); //doesn't matter if
throw is
false or true.
} catch (const ost::Exception& e) {
cerr << "commonc++ exception:" << e.getString() << endl;
} catch (const std::exception& e) {
cerr << "std exception:" << e.what() <<endl;
} catch (...) {
cerr << "unknown exception" << endl;
};
return EXIT_SUCCESS;
}
Output:
bash-2.05$ g++ main.cpp -o ex -lccgnu -lpthread -ldl
bash-2.05$ ./ex
unknown exception
regards,
Łukasz Michalski
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- TCPStream exceptions,
Łukasz Michalski <=