The sock=: : socket (AF_INET SOCK_STREAM, IPPROTO_TCP);
Don't know why the scope qualifier here to use, it also does not have what effect?
CodePudding user response:
The scope, personal understanding, because your own functions have defined a socket, instead of calling repository socket function,CodePudding user response:
1, the function of this code is to remove the port before connection, in order to prevent the port are occupied by the other programs,2, for example, is now a program using 10000 the port, if you don't add this function, can bind failure, after adding this function can be bound to succeed,
CodePudding user response:
: : global, such can declare global function