Protocols

The following protocols are available globally.

  • The Socket protocol provides an interface for a network socket, which is an endpoint in network communication.

    The user can communicate through the streams provided by the socket. Incoming data can be retrieved through the input stream and data can be written to the network with the output stream.

    See more

    Declaration

    Swift

    public protocol Socket : class
  • Delegate for a server socket.

    The delegate of a server socket will receive notifications about new connections or errors.

    See more

    Declaration

    Swift

    public protocol ServerSocketDelegate
  • Output stream for writing to an underlying target.

    Implementation notes:

    Only the function write(data: UnsafePointer<Void>, lengthInBytes byteCount: Int) throws should be implemented. Other write/writeln functions should not be implemented as they are already implemented as an extension which will call the write(data: UnsafePointer<Void>, lengthInBytes byteCount: Int) throws function.

    See more

    Declaration

    Swift

    public protocol OutputStream
  • Protocol for stream-serialization of objects.

    A type implementing this protocol can write itself into an OutputStream.

    If an object should also be stream-deserializable, it must implement the StreamReadable-protocol.

    See more

    Declaration

    Swift

    public protocol StreamWritable
  • Delegate for event reporting of an input stream.

    Reports, if new data is available or if the stream was closed.

    See more

    Declaration

    Swift

    public protocol InputStreamDelegate
  • Input stream for reading from an underlying source.

    Implementation notes:

    The delegate should be notified, when new data comes available or the stream is closed.

    If the stream implementation relies on an underlying stream, the delegate of the underlying stream should be set to this stream.

    The delegate of this stream implementation should then be notified about delegate notifications from the underlying stream.

    See more

    Declaration

    Swift

    public protocol InputStream : class
  • Protocol for a class which supports writing to a stream for custom network protocols.

    See more

    Declaration

    Swift

    public protocol StreamReadable