Tool/software:
Tool/software:
We have established a server and client system using the host computer, with the CC3235 chip serving as the second client. The host computer server connects to the CC3235 operating in AP mode. The host computer client parses file data and sends it to the host computer server. The CC3235 client continuously sends GET requests to check if data on the host computer server has been updated. If updated, it performs corresponding data processing. The host computer connects to the IP address 10.123.45.2, and the CC3235 chip also sends requests to this same address. However, we observed that the server connection would disconnect when the CC3235 continuously sent GET requests. Throughout this process, the CC3235 remained in AP mode.
This is the code for configuring AP mode:
static void ruking_ap_config(void)
{
int status;
Display_printf(display, 0, 0, "Start to config AP mode\r\n");
_u8 Ssid[] = "myWIFI";//Ruking
status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SSID, strlen(Ssid), Ssid);
_u8 val = SL_WLAN_SEC_TYPE_WPA_WPA2;
status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_SECURITY_TYPE, 1, (_u8 *)&val);
_u8 password[] = {"123456789"};
_u16 len = strlen(password);
status = sl_WlanSet(SL_WLAN_CFG_AP_ID, SL_WLAN_AP_OPT_PASSWORD, len, (_u8 *)password);
#if 0
SlNetCfgIpV4Args_t ipV4;
ipV4.Ip = (_u32)SL_IPV4_VAL(10,1,1,201); /* IP address */
ipV4.IpMask = (_u32)SL_IPV4_VAL(255,255,255,0); /* Subnet mask */
ipV4.IpGateway = (_u32)SL_IPV4_VAL(10,1,1,1); /* Default gateway address */
ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(8,16,32,64); /* _u32 DNS server address */
status = sl_NetCfgSet(SL_NETCFG_IPV4_AP_ADDR_MODE,SL_NETCFG_ADDR_STATIC,sizeof(SlNetCfgIpV4Args_t), (_u8 *)&ipV4);
#endif
mode = sl_WlanSetMode(ROLE_AP);
if (mode < 0)
{
Display_printf(display, 0, 0,"\n\r[line:%d, error code:%d] %s\n\r", __LINE__, mode, WLAN_ERROR);
}
}
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
{
int32_t status = 0;
pthread_attr_t pAttrs;
struct sched_param priParam;
if(pNetAppEvent == NULL)
{
return;
}
switch(pNetAppEvent->Id)
{
case SL_NETAPP_EVENT_IPV4_ACQUIRED:
case SL_NETAPP_EVENT_IPV6_ACQUIRED:
break;
case SL_NETAPP_EVENT_DHCPV4_LEASED:
{
sprintf((char *)gStationIp, "%d.%d.%d.%d",
SL_IPV4_BYTE(pNetAppEvent->Data.IpLeased.IpAddress,3), SL_IPV4_BYTE(pNetAppEvent->Data.IpLeased.IpAddress,2),
SL_IPV4_BYTE(pNetAppEvent->Data.IpLeased.IpAddress,1), SL_IPV4_BYTE(pNetAppEvent->Data.IpLeased.IpAddress,0));
Display_printf(display, 0, 0, "\n\r[NETAPP EVENT] IP Leased to Client: IP=%s \n\r", gStationIp);
sem_post(&ipEventSyncObj);
}
break;
default:
break;
}
}
Hi,
What do you want to achieve by this handler? It just show IP address leased by the DHCP server inside CC32xx and signalise this by the semaphore, save to gStationIp for later usage.
Maybe you can check at your computer by Wireshark what is going on. Do you have disabled firewall?
Jan
Thank you for your advice of Wireshark. And I haven't disabled firewall. Based on the Wireshark logs, does this indicate that the firewall is blocking DNS queries? Additionally, the server port is 80, but the client port for 10.123.45.1 (CC3235) keeps changing. Is this normal, or am I missing a relevant configuration? If it's possible to set a fixed port, is there a related process for doing so?
Hi,
That source port for TCP connection is changing is pretty normal. You don't need to change this. Actually this is way which allows proper function of NAT (if its used at network).
Your PC (.2) is asking of your CC32xx (.1) for resolving some DNS address. And because CC32xx not knows the answer you response it that.
Issue with SYN is likely your PC server is not responding. Why? I don't know.
Jan
Hi Aodong,
Connection refusal (code -111) can definitely be caused by your firewall. Someone in another thread had a similar issue, but they were trying connect to an IPv6 address, maybe it can help you. Here is the thread.
Best,
Brandon Liu