请帮我解释一下这段程序要表达的意思,万分感谢! 30
{socket(0,Sn_MR_TCP,5000,0);listen(0);if(getSn_SR(0)==SOCK_LISTEN){printf("ListenMode...
{
socket(0, Sn_MR_TCP, 5000, 0);
listen(0);
if( getSn_SR(0) == SOCK_LISTEN)
{
printf("Listen Mode");
}
while(getSn_RX_RSR(0) ==0 );
printf("got data \r\n");
len = getSn_RX_RSR(0);
printf("the size is %u \r\n",len);
uint8 * TX_BUFFER = (uint8 *) TX_BUF;
uint8 * RX_BUFFER = (uint8 *) RX_BUF;
if( len > MAX_SIZE)
len = MAX_SIZE;
len = recv(0,RX_BUFFER,len);
send(0,RX_BUFFER,len);
} 展开
socket(0, Sn_MR_TCP, 5000, 0);
listen(0);
if( getSn_SR(0) == SOCK_LISTEN)
{
printf("Listen Mode");
}
while(getSn_RX_RSR(0) ==0 );
printf("got data \r\n");
len = getSn_RX_RSR(0);
printf("the size is %u \r\n",len);
uint8 * TX_BUFFER = (uint8 *) TX_BUF;
uint8 * RX_BUFFER = (uint8 *) RX_BUF;
if( len > MAX_SIZE)
len = MAX_SIZE;
len = recv(0,RX_BUFFER,len);
send(0,RX_BUFFER,len);
} 展开
2个回答
展开全部
{
socket(0, Sn_MR_TCP, 5000, 0); //调用socket函数
listen(0);//调用listen函数
if( getSn_SR(0) == SOCK_LISTEN)//若 getSn_SR(0)等于 SOCK_LISTEN,执行:printf("Listen Mode");屏幕显示Listen Mode
{
printf("Listen Mode");
}
while(getSn_RX_RSR(0) ==0 );//等待函数getSn_RX_RSR返回0
printf("got data \r\n");//屏幕显示:got data
len = getSn_RX_RSR(0); //蒋函数getSn_RX_RSR(0)值赋给len
printf("the size is %u \r\n",len);//显示:the size is 和无符号数,len
uint8 * TX_BUFFER = (uint8 *) TX_BUF;//定义uint8型指针,指向TX_BUF
uint8 * RX_BUFFER = (uint8 *) RX_BUF;定义uint8型指针,指向RX_BUF
if( len > MAX_SIZE)//若len大于MAX_SIZE,将MAX_SIZE赋给len
len = MAX_SIZE;
len = recv(0,RX_BUFFER,len);//蒋recv函数返回值赋给len
send(0,RX_BUFFER,len);//调用send
} //这个程序是一个Socket程序,很难的
socket(0, Sn_MR_TCP, 5000, 0); //调用socket函数
listen(0);//调用listen函数
if( getSn_SR(0) == SOCK_LISTEN)//若 getSn_SR(0)等于 SOCK_LISTEN,执行:printf("Listen Mode");屏幕显示Listen Mode
{
printf("Listen Mode");
}
while(getSn_RX_RSR(0) ==0 );//等待函数getSn_RX_RSR返回0
printf("got data \r\n");//屏幕显示:got data
len = getSn_RX_RSR(0); //蒋函数getSn_RX_RSR(0)值赋给len
printf("the size is %u \r\n",len);//显示:the size is 和无符号数,len
uint8 * TX_BUFFER = (uint8 *) TX_BUF;//定义uint8型指针,指向TX_BUF
uint8 * RX_BUFFER = (uint8 *) RX_BUF;定义uint8型指针,指向RX_BUF
if( len > MAX_SIZE)//若len大于MAX_SIZE,将MAX_SIZE赋给len
len = MAX_SIZE;
len = recv(0,RX_BUFFER,len);//蒋recv函数返回值赋给len
send(0,RX_BUFFER,len);//调用send
} //这个程序是一个Socket程序,很难的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询