您好:
cc3000 在接收数据的时候,用的是阻塞,但是过了一段时间,server并没有发送数据,但是跳出了阻塞状态,这个问题是怎么回事儿?如何解决?
谢谢!
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.
代码:
void connectSocket(long * Socket)
{
creatAndOpenSocket(Socket);
firstTimeConnected=NotFirstTimeConnect ;
SocketConnected=-1;
// the family is always AF_INET
tSocketAddr.sa_family = AF_INET;
// the destination port
tSocketAddr.sa_data[0] = (ClientPort)>>8;
tSocketAddr.sa_data[1] = (unsigned char)(ClientPort);
// the destination IP address
tSocketAddr.sa_data[2] = ServerIPaddress[0];
tSocketAddr.sa_data[3] = ServerIPaddress[1];
tSocketAddr.sa_data[4] = ServerIPaddress[2];
tSocketAddr.sa_data[5] = ServerIPaddress[3];
while(SocketConnected==-1)
{
SocketConnected=connect(*Socket,&tSocketAddr,sizeof(sockaddr));
if(SocketConnected==0)
{
turnLedOn(6);
}
else
{
turnLedOn(6);
__delay_cycles(600000);
turnLedOff(6);
__delay_cycles(600000);
}
}
}
void creatAndOpenSocket(long * Socket)
{
while ((ulCC3000DHCP == 0) || (ulCC3000Connected == 0))
{
__delay_cycles(1000);
}
long theSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
Socket=&theSocket;
}