Update mc_tcp.cpp

This commit is contained in:
Eao3piq4e 2022-08-10 18:37:51 +08:00
parent 3a2a690ee8
commit 272ebd125f
1 changed files with 11 additions and 0 deletions

View File

@ -629,6 +629,17 @@ int mc_tcp_addr_init(const char* host, int port, struct sockaddr_storage* ss, in
return (error == 1) ? 0 : error;
}
/*
function name: mc_tcp_connect_nonblock
description: This function is used to create a socket and establish a connection with the port of the specified host
in non blocking mode.
arguments: The first parameter specifies a specific host, and the second parameter specifies a specific port of the host.
return value: If the connection is successfully established, the file descriptor of the socket connected to the port of the
specified host is returned; otherwise, - 1 is returned.
note: none
date: 2022/8/10
contact tel: 18720816902
*/
int mc_tcp_connect_nonblock(const char* host, int port)
{
int sockfd, n;