- Inherits From:
- NSFileHandle
- Declared In:
- EDSocket.h
inet
. There are, however, a lot of other families that you might want to support; Unix domain sockets or Appletalk for example.Note that some socket related functionality is implemented in a category on NSFileHandle.
NSFileHandle *realHandle;
realHandle All instance variables are private.
Describing socket classesCreating new sockets
- + protocolFamily
- + socketType
- + socketProtocol
Setting socket options
- + socket
- - init
- - initWithFileHandle:
- - setSocketOption:level:value:
- - setSocketOption:level:timeValue:
+ (int)protocolFamily
Must be overriden to return the protocol family for the socket class; for example PF_INET
for IP sockets.
+ (id)socket
Creates and returns a socket. Of course, subclasses inherit this method which means a TCP socket can be created as [EDTCPSocket socket]
.
+ (int)socketProtocol
Must be overriden to return the protocol for the socket class; for example IPPROTO_TCP
for TCP sockets.
+ (int)socketType
Must be overriden to return the type for the socket class; for example SOCK_STREAM
for TCP sockets.
- (id)init
Initialises a newly allocated socket by creating a POSIX socket with the protocol family, protocol and type as defined by the corresponding class methods.
- (id)initWithFileHandle:(NSFileHandle *)aFileHandle
Initialises a newly allocated socket by wrapping aFileHandle. The file handle's file descriptor must represent a socket.
- (void)setSocketOption:(int)anOption level:(int)aLevel timeValue:(NSTimeInterval)timeout
Sets the socket option described by anOption on protocol level aLevel to timeout. You should not call this method directly but use the "appropriatly" named methods in subclasses, e.g. setSendTimeout:.
- (void)setSocketOption:(int)anOption level:(int)aLevel value:(int)value
Sets the socket option described by anOption on protocol level aLevel to value. You should not call this method directly but use the "appropriatly" named methods in subclasses, e.g. setAllowsAddressReuse: or setSendsDataImmediately:.