Socket Set Functions
Operating System Abstraction » Sockets and Socket Sets

## Topics

| Socket Functions

## Creation and destruction

GWENHYWFAR_API GWEN_SOCKETSET * | GWEN_SocketSet_new (void)
GWENHYWFAR_API void | GWEN_SocketSet_free (GWEN_SOCKETSET *ssp)
GWENHYWFAR_API int | GWEN_SocketSet_Clear (GWEN_SOCKETSET *ssp)
GWENHYWFAR_API GWEN_SOCKET * | GWEN_Socket_new (GWEN_SOCKETTYPE socketType)
GWENHYWFAR_API GWEN_SOCKET * | GWEN_Socket_fromFile (int fd)
GWENHYWFAR_API void | GWEN_Socket_free (GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_Open (GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_Socket_Close (GWEN_SOCKET *sp)

## Add, remove, check sockets

These functions allow adding and removing sockets to/from a socket set as well as checking whether a specific socket is part of a socket set.
GWENHYWFAR_API int | GWEN_SocketSet_AddSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_RemoveSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_HasSocket (GWEN_SOCKETSET *ssp, const GWEN_SOCKET *sp)
GWENHYWFAR_API int | GWEN_SocketSet_GetSocketCount (GWEN_SOCKETSET *ssp)

## Detailed Description

These functions operate on socket sets. A socket set is used by the socket function GWEN_Socket_Select() to check on which socket changes in state occurred.

## Function Documentation

## GWEN_Socket_Close()

GWENHYWFAR_API int GWEN_Socket_Close | ( | GWEN_SOCKET * | sp | ) |

Unarms a socket thus closing any connection associated with this socket.

References GWENHYWFAR_API.

## GWEN_Socket_free()

GWENHYWFAR_API void GWEN_Socket_free | ( | GWEN_SOCKET * | sp | ) |

Destructor.

References GWENHYWFAR_API.

## GWEN_Socket_fromFile()

GWENHYWFAR_API GWEN_SOCKET * GWEN_Socket_fromFile | ( | int | fd | ) |

References GWENHYWFAR_API.

## GWEN_Socket_new()

GWENHYWFAR_API GWEN_SOCKET * GWEN_Socket_new | ( | GWEN_SOCKETTYPE | socketType | ) |

Constructor. You should always use this to create socket variables.

References GWENHYWFAR_API.

## GWEN_Socket_Open()

GWENHYWFAR_API int GWEN_Socket_Open | ( | GWEN_SOCKET * | sp | ) |

Arms the socket so that it can be used. This really creates a system socket.

References GWENHYWFAR_API.

## GWEN_SocketSet_AddSocket()

GWENHYWFAR_API int GWEN_SocketSet_AddSocket | ( | GWEN_SOCKETSET * | ssp,
|  | const GWEN_SOCKET * | sp )

References GWENHYWFAR_API.

## GWEN_SocketSet_Clear()

GWENHYWFAR_API int GWEN_SocketSet_Clear | ( | GWEN_SOCKETSET * | ssp | ) |

References GWENHYWFAR_API.

## GWEN_SocketSet_free()

GWENHYWFAR_API void GWEN_SocketSet_free | ( | GWEN_SOCKETSET * | ssp | ) |

References GWENHYWFAR_API.

## GWEN_SocketSet_GetSocketCount()

GWENHYWFAR_API int GWEN_SocketSet_GetSocketCount | ( | GWEN_SOCKETSET * | ssp | ) |

References GWENHYWFAR_API.

## GWEN_SocketSet_HasSocket()

GWENHYWFAR_API int GWEN_SocketSet_HasSocket | ( | GWEN_SOCKETSET * | ssp,
|  | const GWEN_SOCKET * | sp )

References GWENHYWFAR_API.

## GWEN_SocketSet_new()

GWENHYWFAR_API GWEN_SOCKETSET * GWEN_SocketSet_new | ( | void |  | ) |

References GWENHYWFAR_API.

## GWEN_SocketSet_RemoveSocket()

GWENHYWFAR_API int GWEN_SocketSet_RemoveSocket | ( | GWEN_SOCKETSET * | ssp,
|  | const GWEN_SOCKET * | sp )