[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-myserver] Test case for class socket ready + patch
From: |
ivailo ilionov |
Subject: |
[bug-myserver] Test case for class socket ready + patch |
Date: |
Sun, 29 Mar 2009 12:16:21 +0300 |
The function 'Socket::ioctlsocket' isn't tested, but it is used internally by 'Socket::bytesToRead', so if there are problems the test case should
be able to catch them. Well, there are some more functions that aren't tested, but they are trivial...
The patch is for base/socket/socket.cpp . It makes 'Socket::write' similiar to 'Socket::read' in that that now they both change the expected
read/write values in nbr/nbw, which may be -1 if error. Previously, only 'Socket::read' did that.
Here are some notes:
In socket.cpp u_long Socket::bytesToRead -- should the macro #ifdef FIONHEAD
be changed to #ifdef WIN32 ?
In socket.cpp int Socket::recv ( char*, int, int, u_long ) -- how does a
caller distinguish between orderly shutdown and the returned 0 at the end?
If there's a timeout and no sockets are ready, then also value of 0 is
returned again.
In socket.cpp int Socket::recv ( char*, int, int ) -- i thought that the
value of 0 returned by recv is not an error. Or is it the desired behaviour
to be to always handle anything but > 0 values, as errors ? ( "unless
data was recv()`ed, it's an error - do something" )
socket.diff
Description: Text document
test_socket.cpp.gz
Description: GNU Zip compressed data
- [bug-myserver] Test case for class socket ready + patch,
ivailo ilionov <=