Jump to main content

##

# TCPIP_HTTP_NET_ConnectionSocketGet Function

## C

    NET_PRES_SKT_HANDLE_T TCPIP_HTTP_NET_ConnectionSocketGet(
        TCPIP_HTTP_NET_CONN_HANDLE connHandle
    );

## Description

The function returns the network transport socket of the specified HTTP connection. The user gets access to the connection socket which it can use for debugging or directly sending/reading data.

## Preconditions

None.

## Parameters

Parameters | Description
--- | ---
connHandle | HTTP connection handle.

## Returns

- NET_PRES_SKT_HANDLE_T for the connection defined by connHandle.

## Remarks

This function gives direct access to the underlying transport socket. It is meant for test/advanced usage only. The regular connection functions should be used for manipulation of the connection data. Using the socket directly for data manipulation will disrupt the HTTP server functionality.

## Example

    uint32_t byteCount;
    int sktRxSize;

    byteCount = TCPIP_HTTP_NET_ConnectionByteCountGet(connHandle);
    sktRxSize = TCPIP_HTTP_NET_ConnectionReadBufferSize(connHandle);

    if(byteCount > sktRxSize)
    {   // Configuration Failure
        TCPIP_HTTP_NET_ConnectionStatusSet(connHandle, TCPIP_HTTP_NET_STAT_REDIRECT);
        return TCPIP_HTTP_NET_IO_RES_DONE;
    }