Update mc_tcp.cpp

This commit is contained in:
Eao3piq4e 2022-08-10 11:10:09 +08:00
parent cd677d1243
commit 4728c88126
1 changed files with 12 additions and 1 deletions

View File

@ -187,7 +187,7 @@ arguments: The first argument indicates the socket descriptor that has been esta
The third argument is byte length of sockaddr structure.
return value: Return errno, the return value is 0 if succeed, else one of other error types is returned for failure.
note: none
date: 2022/8/8
date: 2022/8/9
contact tel: 18720816902
*/
int mc_tcp_bind(int fd, const struct sockaddr* sa, socklen_t salen)
@ -349,6 +349,17 @@ int mc_tcp_read_nonblock(int fd, void* data, int size, int flags)
return (size_t)nbytes;
}
/*
function name: mc_tcp_check_socket
description: This function binds the specified socket to a specific IP address and port.
arguments: The only argument indicates the specific socket that has been established.
return value: Return -1 if when the recv function wait for the protocol to receive data,
the other end of TCP closes the connection or a real error occurred while
reading data. In other cases, 0 is returned.
note: none
date: 2022/8/10
contact tel: 18720816902
*/
int mc_tcp_check_socket(int sock)
{
char temp_buf[IOV_DATA_SIZE] = {0};