GCC rw.c
Rw.c:75:6: warning:conflicting types for ' process_conn_server '
void Process_conn_server (int s)
^
Rw.c:64:4: note:previous Implicit declaration of ' Process_conn_server ' is here
Process_conn_server (SC);
^
The above problem is the lack of pre-defined functions
void Process_conn_server (int s);
Host CPU and operating system vary widely, the host's byte sequence can not be unified, but on the network transmission of variables, its value must have a uniform representation, network byte sequence refers to the representation of multi-byte variables in the network transmission
Network byte order refers to the representation of multi-byte variables when they are transmitted over a network
High-end byte order for network byte order
Network byte order the use of high-end small-endian byte-order variables in the network transfer variables need to do byte-order conversion, big-endian byte-order variables do not need to convert
Programming is convenient, the user's program is independent of the platform, the Linux operating system provides the following functions for byte-order conversion
#include <arpa/inet.h>
uint32_t htonl (uint32_t hostlong); /* Host byte order to network byte-order long Integer */
uint16_t htons (uint16_t hostshort);
uint32_t ntonl (uint32_t netlong);
uint16_t Ntohs (uint16_t netshort);
Host to net long;
uint32_t htonl (uint32_t hostlong);
uint32_t unsigned int
Hostlong
Netlong
Hostshort
Netshort
The variable passed in by the function is a variable that needs to be converted, the function passed in, the struct is a union type, is assigned by value, and the byte sequence is converted by a byte array.
Value assignment, byte-order conversion through a byte array
C Programming Debug Set