sorry ,i have many questions,can anyone give the sample code for below function?
1.cc3000 as a tcp server.
2.cc3000 as a tcp client.
2.cc3000 as a udp server
now i can send data use Wifi_send_data(),but others i don't know how to do?
anyone help?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
oh,good.
i have implemented some function of the tcp server,i can connect the device ,but when connected it,the device stuck on function hci_event_handler,what should i do next.
and this is my code:
ulSocket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(ulSocket == -1)
{
printf("socket error !");
continue;
}
serverSock.sa_family=AF_INET;
serverSock.sa_data[0]=(port&0xff00)>>8;
serverSock.sa_data[1]=(port&0xff);
memset(&serverSock.sa_data[2],0,4);
if (bind(ulSocket,&serverSock,sizeof(serverSock))==-1)
{
printf("bind error !");
continue;
}
if (listen(ulSocket,5)==-1)
{
printf("listen error");
continue;
}
while(1)
{
printf("wait\r\n");
clientDescript=accept(ulSocket,(sockaddr*)&romoteAddr,&addrLen);
if (clientDescript<0)
{
printf("accept error !");
continue;
}
printf("get one\r\n");
while(1)
{
recv(ulSocket,receiveData,255,0);
if (receiveData[0]==1)
{
printf("get");
}
}
}
Hi Augus,
Where does it exactly get stuck?
I see that you are using listening socket's descriptor 'ulSocket' while doing a receive. Please use the 'clientDescript' in recv and it should work.
Thanks & Regards,
Raghavendra