- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
"));
}
}
- Tags:
- &ap_ip_settings
- &tcp_client_socket
- .below
- .gateway
- .ip_address
- .netmask
- 169
- 254
- 255
- ap_ip_settings
- application_startvoid
- bring
- client
- connected
- connection
- const
- create
- creation
- define
- device
- establish
- failedrn
- include
- initialise
- initialiser_ipv4_address
- interface
- laptop
- listen
- make_ipv4_address
- mode
- network
- server
- socket
- softap
- static
- tcp_server_port
- tool
- unsuccessful
- void
- wait
- wiced.h
- wiced_ap_interface
- wiced_init
- wiced_ip_setting_t
- wiced_network_upwiced_ap_interface
- wiced_success
- wiced_tcp_accept
- wiced_tcp_create_socket&tcp_client_socket
- wiced_tcp_listen&tcp_client_socket
- wiced_use_internal_dhcp_server
- wifi
- wprint_app_infotcp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Is this still an issue for you?
Or did you resolve it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Discussion is being locked. If you have any follow-up, please start a new discussion.