C Programming Debug Set

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.