[Overview][Constants][Types][Procedures and functions][Index] | Reference for unit 'Sockets' (#rtl)

# fpsocket

Create new socket

## Declaration

Source position: socketsh.inc line 161

`function fpsocket(`
`domain: cint;`
`xtype: cint;`
`protocol: cint`
`):cint;`

## Description

fpSocket creates a new socket in domain Domain, from type xType using protocol Protocol. The Domain, Socket type and Protocol can be specified using predefined constants (see the section on constants for available constants) If succesfull, the function returns a socket descriptor, which can be passed to a subsequent fpBind call. If unsuccesfull, the function returns -1.

for an example, see Accept.

## Errors

Errors are returned in SocketError, and include the follwing:

ESockEPROTONOSUPPORT
  The protocol type or the specified protocol is not supported within this domain.
ESockEMFILE
  The per-process descriptor table is full.
SYS_ENFILE
  The system file table is full.
ESockEACCESS
  Permission to create a socket of the specified type and/or protocol is denied.
ESockENOBUFS
  Insufficient buffer space is available. The socket cannot be created until sufficient resources are freed.

## See also

FPSocketPair |  | Create socket pair.

Documentation generated on: Feb 26 2014