ot::net
class SocketDescriptor
#include "ot/net/SocketDescriptor.h"
An abstract base class representing socket handles.
By using reference-counted SocketDescriptors, OpenTop is able to share socket handles between multiple objects, preventing the socket from being closed until all references to the SocketDescriptor have been removed.
This is a SynchronizedObject to allow OpenTop to synchronize some socket operations so that they may be safely called by multiple threads.
OSSocketDescriptorType
typedef int OSSocketDescriptorType
Constructor/Destructor Detail |
SocketDescriptor
SocketDescriptor(OSSocketDescriptorType fd)
-
Constructs a SocketDescriptor from an operating system socket handle.
~SocketDescriptor
~SocketDescriptor()
-
Destructor.
Calls getAutoClose() and closes the related resource if it returns true.
close
void close()
-
Closes the socket.
getFD
OSSocketDescriptorType getFD() const
-
Returns an operating system handle for the socket.
getSocketFlags
int getSocketFlags() const
-
Returns the current socket flags.
- See also:
-
setSocketFlags
- Multi-threaded considerations:
-
Can safely be called from multiple concurrent threads.
modifySocketFlags
int modifySocketFlags(int flagsToSet,
int flagsToUnset)
-
Sets the socket flags.
Each open socket has a set of flags associated with it for use by internal OpenTop routines.
- Parameters:
flagsToSet
-
a value whose bits are ORed with the existing flag bits to arrive at a new value.
flagsToUnset
-
a value whose bits are NANDedd with the existing flag bits to arrive at a new value.
- Returns:
-
the new flag value
- Multi-threaded considerations:
-
Can safely be called from multiple concurrent threads.
setSocketFlags
void setSocketFlags(int flags)
-
Sets the socket flags.
Each open socket has a set of flags associated with it for use by internal OpenTop routines.
- Parameters:
flags
-
the new flag value
- Multi-threaded considerations:
-
Can safely be called from multiple concurrent threads.
toString
virtual String toString() const
-
Returns a string representation of this ResourceDescriptor.
OpenTop uses the string representation to identify the resource descriptor when tracing via the Tracer class.
- Since:
-
1.3
Found a bug or missing feature? Please email us at support@elcel.com