bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exceptionhandling in socket.cpp


From: Merandos
Subject: Exceptionhandling in socket.cpp
Date: Mon, 15 Dec 2003 23:03:22 +0100
User-agent: KMail/1.5.4

Hello,

i just started working with the CommonC++ framework under the Debian unstable 
distro. i used apt-get install to install the package and can successfull 
compile the demo apps.

However when i started my own first app that uses sockets, i have problems 
catching any exception. 

for example, when i am reading data from a a tcpsocket server socket that is 
no longer connected, i thought this socket would throw an exception.
"ispending(Socket::pendingInput)" does not work for this case, because it 
returns true even when a client disconnects (which matches the behaviour of 
select() ).

try {
//reading and writing to a tcpsocket based connection.
//*tcp() << myOutData;
//*tcp() >> myInData;
}

//does not shop up
catch(Socket *socket) {
                cerr << "socket exception in servertread! - EXIT this thread
\n";
                ::exit(-1); //quick and dirty for testing only 
}

//does not shop up
catch( ... ) {
        cerr << "unkown exception in servertread! - EXIT this thread\n";
        ::exit(-1); //quick and dirty for testing only
}

can anyone advise what i need to do to get exceptions.?

Thx in advance

Wolfgang





reply via email to

[Prev in Thread] Current Thread [Next in Thread]