Jump to main content

##

# TCPIP_HTTP_CurrentConnectionSocketGet Function

## C

    TCP_SOCKET TCPIP_HTTP_CurrentConnectionSocketGet(
        HTTP_CONN_HANDLE connHandle
    );

## Description

The function returns the TCP socket of the specified HTTP connection. The user gets access to the connection socket which it can use for sending/reading data.

## Preconditions

None.

## Parameters

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

## Returns

TCP_SOCKET for the connection defined by connHandle.

## Remarks

None.

## Example

    uint32_t byteCount;
    TCP_SOCKET sktHTTP;

    byteCount = TCPIP_HTTP_CurrentConnectionByteCountGet(connHandle);
    sktHTTP = TCPIP_HTTP_CurrentConnectionSocketGet(connHandle);
    if(byteCount > TCPIP_TCP_GetIsReady(sktHTTP) + TCPIP_TCP_FifoRxFreeGet(sktHTTP))
    {   // Configuration Failure
        TCPIP_HTTP_CurrentConnectionStatusSet(connHandle, HTTP_REDIRECT);
        return HTTP_IO_DONE;
    }