I have dicsovered this project recently and I think it's really a *great* idea to have a portable class library covering many general issues.
And now my questions concerning CC++:
1. I thought it naturally for a sockect class to have Send and Receive methods.
How could I use a socket class from CC++ (not a stream) to send and receive data ?
2. I didn't find out how to specify send/receive timeouts.
Why doesn't CC++ employ SO_RCVTIMEO/SO_SNDTIMEO where available ?
3. Why there are no dedicated exception classes ?
In most places I see code like this "throw(this)".
I thought it would be nice to have a separate tree of exceptio classes. exception class from STL could serve as root.
I'd like to write code like this:
tcp.setRecvTimeout(1000);
try {
...
tcp >> i;
...
}
catch(SocketException &e) {
if (e.code() == ETIMEDOUT)
// handle timeout
...
}
4. In general I think it would be be very helpful to have a FAQ treating common (stupid) questions like mine. :)
regards,
nomadik
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have dicsovered this project recently and I think it's really a *great* idea to have a portable class library covering many general issues.
And now my questions concerning CC++:
1. I thought it naturally for a sockect class to have Send and Receive methods.
How could I use a socket class from CC++ (not a stream) to send and receive data ?
2. I didn't find out how to specify send/receive timeouts.
Why doesn't CC++ employ SO_RCVTIMEO/SO_SNDTIMEO where available ?
3. Why there are no dedicated exception classes ?
In most places I see code like this "throw(this)".
I thought it would be nice to have a separate tree of exceptio classes. exception class from STL could serve as root.
I'd like to write code like this:
tcp.setRecvTimeout(1000);
try {
...
tcp >> i;
...
}
catch(SocketException &e) {
if (e.code() == ETIMEDOUT)
// handle timeout
...
}
4. In general I think it would be be very helpful to have a FAQ treating common (stupid) questions like mine. :)
regards,
nomadik
I agree...
Here's a way you can check the send/recv status of a socket without blocking (second arg is the timeout in ms):
pend = usock_b.isPending( SOCKET_PENDING_INPUT, 5000 );
Check out isPending().