SOSocket

Syntax

#include <cafe.h>
#include <cafe/network.h>

int SOSocket(int family, int type, int proto);

Parameters

family Protocol family to be used.
AF_INET is the currently supported protocol address family.
type Type of socket:
  • SOCK_STREAM
  • SOCK_DGRAM
proto Protocol to be used with this socket.

Return Values

A file descriptor for the new socket upon success. Upon failure, -1 is returned and errno is set appropriately.

Errors

SO_ELIBNOTREADY Socket library is not initialized.
SO_ENOMEM Insufficient memory in the stack.
SO_EPROTOTYPE Specified type is not supported.
SO_EPROTONOSUPPORT The protocol type or the specified protocol is not supported within this domain.
SO_EMFILE Too many sockets open. No more socket file descriptors available. Socket cannot be created until existing sockets are closed.
SO_EBUSY Socket resource manager busy processing requests.
SO_EABORTED Indicates the operation was aborted. For example, this error can be returned for calls blocked on a socket after the socket is closed by another thread.
SO_EUNKNOWN Unknown error.
SO_ERANGEINVALID Internal API error, invalid error code.
SO_EAPIERROR Internal API error.
SO_EINVAL Invalid operation occurred in the stack.
SO_EAFNOSUPPORT Non-supported address family.

Description

Creates a communications endpoint and returns a descriptor.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

See Also

SOAccept
SOBind
SOConnect
SOListen
SOShutdown

Revision History

2012/10/09 Updated Errors section.
2012/08/16 Cleanup pass.
2012/01/10 Added info about SO_EMFILE error code.
2011/07/11 Added Errors section.
2011/02/21 Initial version.


CONFIDENTIAL