NET_PRES_SocketOpen Function

C

NET_PRES_SKT_HANDLE_T NET_PRES_SocketOpen(NET_PRES_INDEX index, NET_PRES_SKT_T socketType, NET_PRES_SKT_ADDR_T addrType, NET_PRES_SKT_PORT_T port, NET_PRES_ADDRESS * addr, NET_PRES_SKT_ERROR_T* error); 

Returns

  • NET_PRES_INVALID_SOCKET - No sockets of the specified type were available to be opened

  • NET_PRES_SKT_HANDLE_T handle - Returned when NET_PRES_INVALID_SOCKET is returned. Save this handle and use it when calling all other presentation socket APIs.

Description

Provides a unified method for opening all presentation sockets types. Sockets are created at the presentation layer module initialization, and can be claimed with this function and freed using NET_PRES_SocketClose. The presentation layer will call the corresponding open function in the transport layer, and if encryption is specified the presentation layer will also handle encryption negotiation.

Preconditions

The MPLAB Harmony Networking Presentation Layer is initialized.

Parameters

ParametersDescription
indexIndex of the presentation layer.
socketTypeThe type of socket to open.
addTypeThe type of address being used. This is passed unaltered to the transport layer.
portThe port to listen or to send to. This is passed unaltered to the transport layer.
addrAddress to use. This is passed unaltered to the transport layer.
errorThe extended error code of the function.