[HUST CSE][example] fix some typo bugs about 'sucess' and others. (#7528)

This commit is contained in:
shandianchengzi
2023-05-18 10:42:44 -04:00
committed by GitHub
parent c349fe68b8
commit a294d7da9a
15 changed files with 39 additions and 39 deletions
+7 -7
View File
@@ -72,7 +72,7 @@ static void tcpclient(void *arg)
/* 创建一个socket,类型是SOCKET_STREAMTCP类型 */
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
/* Failed on creatinf socket */
/* Failed on creating socket */
/* 创建socket失败 */
LOG_E("Create socket error");
goto __exit;
@@ -87,7 +87,7 @@ static void tcpclient(void *arg)
/* 连接到服务端 */
if (connect(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
{
/*Failed on connecting to server*/
/* Failed on connecting to server */
/* 连接失败 */
LOG_E("Connect fail!");
goto __exit;
@@ -119,14 +119,14 @@ static void tcpclient(void *arg)
}
else if (bytes_received == 0)
{
/* Print warning message when recv function return 0 */
/* Print warning message when recv function returns 0 */
/* 打印recv函数返回值为0的警告信息 */
LOG_W("Received warning, recv function return 0.");
LOG_W("Received warning, recv function returns 0.");
continue;
}
else
{
/* Receive data sucessfully and append '\0' at the end of message */
/* Receive data successfully and append '\0' at the end of message */
/* 有接收到数据,把末端清零 */
recv_data[bytes_received] = '\0';
@@ -156,9 +156,9 @@ static void tcpclient(void *arg)
}
else if (ret == 0)
{
/* Print warning message when send function return 0 */
/* Print warning message when send function returns 0 */
/* 打印send函数返回值为0的警告信息 */
LOG_W("Send warning, send function return 0.");
LOG_W("Send warning, send function returns 0.");
}
}
+1 -1
View File
@@ -76,7 +76,7 @@ void tcp_senddata(const char *url, int port, int length)
else if (result == 0)
{
/* 打印send函数返回值为0的警告信息 */
rt_kprintf("\n Send warning,send function return 0.\r\n");
rt_kprintf("\n Send warning,send function returns 0.\r\n");
}
}
}
+6 -6
View File
@@ -106,7 +106,7 @@ static void tcpserv(void *arg)
/* Accept a request from client and the function is blocking */
/* 接受一个客户端连接socket的请求,这个函数调用是阻塞式的 */
connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size);
/* Return the socket connected sucessfully */
/* Return the socket connected successfully */
/* 返回的是连接成功的socket */
if (connected < 0)
{
@@ -139,13 +139,13 @@ static void tcpserv(void *arg)
}
else if (bytes_received == 0)
{
/* Print warning message when recv function return 0 */
/* Print warning message when recv function returns 0 */
/* 打印recv函数返回值为0的警告信息 */
LOG_W("Received warning, recv function return 0.");
LOG_W("Received warning, recv function returns 0.");
continue;
}
else
{ /* Receive data sucessfully and append '\0' at the end of message */
{ /* Receive data successfully and append '\0' at the end of message */
/* 有接收到数据,把末端清零 */
recv_data[bytes_received] = '\0';
if (strcmp(recv_data, "q") == 0 || strcmp(recv_data, "Q") == 0)
@@ -184,9 +184,9 @@ static void tcpserv(void *arg)
}
else if (ret == 0)
{
/* Print warning message when send function return 0 */
/* Print warning message when send function returns 0 */
/* 打印send函数返回值为0的警告信息 */
LOG_W("Send warning, send function return 0.");
LOG_W("Send warning, send function returns 0.");
}
}
}
+2 -2
View File
@@ -50,7 +50,7 @@ static void udpclient(void *arg)
/* 创建一个socket,类型是SOCK_DGRAMUDP类型 */
if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
{
/* Failed on creatinf socket */
/* Failed on creating socket */
LOG_E("Create socket error");
return;
}
@@ -71,7 +71,7 @@ static void udpclient(void *arg)
/* 发送数据到服务远端 */
sendto(sock, send_data, rt_strlen(send_data), 0,
(struct sockaddr *)&server_addr, sizeof(struct sockaddr));
/* Thread sllep for 1 second */
/* Thread sleep for 1 second */
/* 线程休眠一段时间 */
rt_thread_mdelay(1000);
/* count decrease 1 */
+1 -1
View File
@@ -107,7 +107,7 @@ static void udpserv(void *paramemter)
}
else if (bytes_read == 0)
{
LOG_W("Received warning, recv function return 0.");
LOG_W("Received warning, recv function returns 0.");
continue;
}
else