Fixing w5500.

This commit is contained in:
TXuian 2022-12-10 12:11:10 +08:00
parent b101a98f74
commit 1501fff7e9
1 changed files with 11 additions and 5 deletions

View File

@ -312,7 +312,7 @@ void wiz_client_op_test(int argc, char *argv[]) {
* argv[3]: msg
*/
if (argc != 4) {
KPrintf("wiz_client_op <ip> <port> <msg>");
KPrintf("wiz_client_op <ip> <port> <msg>\n");
}
uint8_t client_sock = 2;
uint8_t ip[4] = {192, 168, 31, 127};
@ -323,15 +323,21 @@ void wiz_client_op_test(int argc, char *argv[]) {
for (int i = 0; i < 4; ++i) {
ip[i] = (uint8_t)tmp_ip[i];
}
KPrintf("wiz client to %d.%d.%d.%d:%d", ip[0], ip[1], ip[2], ip[3], port);
KPrintf("wiz client to %d.%d.%d.%d:%d\n", ip[0], ip[1], ip[2], ip[3], port);
uint8_t buf[g_wiznet_buf_size];
sscanf(argv[3], "%s", buf);
wiz_client_op(client_sock, buf, g_wiznet_buf_size, ip, port, SEND_DATA);
int ret =
wiz_client_op(client_sock, buf, g_wiznet_buf_size, ip, port, SEND_DATA);
if (ret <= 0) {
KPrintf("[W5500] Client Op Failed.\n");
}
MdelayKTask(10);
memset(buf, 0, g_wiznet_buf_size);
// waiting for a responding.
wiz_client_op(client_sock, buf, g_wiznet_buf_size, ip, port, RECV_DATA);
KPrintf("received msg: %s\n", buf);
ret = wiz_client_op(client_sock, buf, g_wiznet_buf_size, ip, port, RECV_DATA);
if (ret > 0) {
KPrintf("received msg: %s\n", buf);
}
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN) |