How to establish the TCP connection in softAP mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello!

I have problem when establish TCP connection in softAP mode, the wifi module running softAP and DHCP mode to asign IP to client,  I want wifi act as TCP server and establish TCP connection to client but when I used the TCP network tool on laptop (client connected to wifi softAP) but unsuccessful .Below is the source code, please verify and let me know whats wrong? Thank you so much!

#include "wiced.h"

#include "resources.h"

#define TCP_PACKET_MAX_DATA_LENGTH        30

#define TCP_SERVER_PORT                   6868

static wiced_tcp_socket_t  tcp_client_socket;

static const wiced_ip_setting_t ap_ip_settings =

{

    INITIALISER_IPV4_ADDRESS( .ip_address, MAKE_IPV4_ADDRESS( 169,254,  1,  1 ) ),

    INITIALISER_IPV4_ADDRESS( .netmask,    MAKE_IPV4_ADDRESS( 255,255,255,  0 ) ),

    INITIALISER_IPV4_ADDRESS( .gateway,    MAKE_IPV4_ADDRESS( 169,254,  1,  1 ) ),

};

void application_start(void)

{

    /* Initialise the device */

wiced_init();

    /* Bring up the softAP interface ------------------------------------------------------------- */

    wiced_network_up(WICED_AP_INTERFACE, WICED_USE_INTERNAL_DHCP_SERVER, &ap_ip_settings);

    /* Create a TCP socket*/

    if (wiced_tcp_create_socket(&tcp_client_socket, WICED_AP_INTERFACE) != WICED_SUCCESS)

        {

            WPRINT_APP_INFO(("TCP socket creation failed

"));

        }

    /* Listen Client on TCP PORT*/

    wiced_tcp_listen(&tcp_client_socket,TCP_SERVER_PORT);

    /* Wait Client Client Establish TCP connection*/

     if( wiced_tcp_accept( &tcp_client_socket )!= WICED_SUCCESS);

            {

                  WPRINT_APP_INFO(("TCP connection failed

"));

               }

}

0 Likes
2 Replies
GregG_16
Employee
Employee
50 sign-ins 25 sign-ins 25 comments on KBA

Hello,

Is this still an issue for you?

Or did you resolve it?

0 Likes
Anonymous
Not applicable

Discussion is being locked. If you have any follow-up, please start a new discussion.

0 Likes