about code layout and white keeping."Results-oriented programmer" (The Pragmatic Programmer:from journeyman to Master)Andrew Hunt and David Thomas(with Chinese version)Those who may still be in college, if they have learned the programming mechanism, but feel unsure about what to do, this is a very appropriate book. Just like the difference between cartography and architecture. What you learn in class is d
Switch learning feature). Layer three switch: based on the traditional two layer switch, the network layer forwarding technology is adopted. We know that the host communication of different networks generally requires router forwarding, if only a local area network is divided into multiple subnets, inter-subnet communication using routers, then the communication efficiency between these subnets will be due
",*pptr); /*according to the address type, the address is typed out*/ Switch(hptr->H_addrtype) { Caseaf_inet: Caseaf_inet6:pptr=hptr->h_addr_list;/*call out all the addresses you just got. where the Inet_ntop () function is called*/ for(; *pptr!=null; pptr++) printf ("address:%s\n", Inet_ntop (hptr->h_addrtype, *pptr, str,sizeof(str))); printf ("First address:%s\n", Inet_ntop (hptr->h_addrtype, hptr->h_addr, str,sizeof(str))); Break; default: printf ("Unknown address type
Readn function function: In the network programming reading data, usually will need to use a read the specified byte to return the function, the Linux system call did not give, need to own encapsulation.READN Implementation code:intREADN (intFdvoid*vptr, size_t N) {size_t Nleft= N;//the READN function also needs to read the number of bytesssize_t nread =0;//the R
1. Learn the basic concepts of Linux network programming Primary Mastery
system resources
Refers to some active units (except storage devices) such as CPU and memory
Program
Refers to compiled binaries that are stored on disk and do not occupy system resources
Process
The program is relocated from the hard
This chapter begins with the introduction of poll ( Linux-specific) multi-channel I/O transfer model. Because multi-process and multithreaded models are relatively simple in implementation, they generally do not use multithreading and multi-process to implement the service model because of their large overhead and CPU height. Select because of its cross-platform, but its maximum limit defaults to 1024, modified to break the 1024 words need to re
opposite fin packet to send its own fin packet this time the network will be in close_wait state, but this period of time is relatively short, unless it is their own side of the network exception can not shut down the connection.Listen's backlog settingsListen inside maintenance of 2 queues, one is already connected to complete the queue, the length of the backlog, one is not complete the connection queue,
To thoroughly understand poll or understand the following code, please refer to the "Linux network programming--i/o multiplexing poll function"Code:1#include string.h>2#include 3#include 4#include 5#include Select.h>6#include 7#include 8#include inch.h>9#include Ten#include One#include A #defineOpen_max 100 - - intMainintargcChar*argv[]) the { - //1. C
People who understand the network transport protocol know that it is easy to use TCP to implement file transfer. As opposed to TCP, because UDP is a connectionless, unreliable transport protocol, we need to consider the issue of packet loss and the first to (packet order), so we want to implement UDP transfer files, we need to solve these two problems. The method is to number the packet, received and stored in the order of the package, the receiver se
question, Epoll sets up a list of ready lists separately, when FD is ready (readable/writable) and placed in the Ready list. Epoll_wait only needs to traverse the ready list, without having to traverse all of the FD, thus saving a lot of CPU time.Epoll has LT and et two operating modes, the default operating mode is LT (horizontal trigger), high-speed operation mode is ET (Edge trigger).It is an FD that notifies the user as long as it is in a readable or writable state, and the user is notified
, typically a concurrent server (a request that can respond to multiple clients at the same time). Concurrent server design techniques generally include : multi-process servers, multi-threaded servers, I/O multiplexing servers, etc.Multi-process Concurrent serverThere are many applications in the Linux environment, the most important of which is the network/client server. A multi-process server is when a cl
Four. DM9000 Network card driver Depth analysis1. Initialization of the DM9000Dm9000_init (){1. Assigning Net_device Structures2. Get the address break number from the Platform_device3. Map the acquired address to the virtual address operation function Io_remp ()4. Read the chip type5. Set the number of operating functions6. Register the network card driver register}2. Dm9000_open (){1. Ifconfig eth0 up}3.
*) arg), Addr_info), Close ((ARG *) arg-CONNECTFD),//free (ARG);p thread_exit (NULL);} int main () {int sockfd, acfd;size_t sin_len = sizeof (struct sockaddr); ARG *arg;struct sockaddr_in client_addr;pthread_t thread;sockfd = Init_tcp_psock (Serv_port); while (1) {if (ACFD = Accept _request (SOCKFD, (struct sockaddr *) client_addr, sin_len)) The implementation of some calling functions in the code. To my GITHUB:HTTPS://GITHUB.COM/SIMON-XIA/LNP. Copyright notice: This article blog original articl
struct Hostent{char *h_name;/* Host's official name */char **h_aliases;/* Host alias list */int H_addrtype;/* Host address type af_inet */int; * The address length of the host */char **h_addr_list; /* Host's IP Address list */} #define H_ADDR h_addr_list[0]/* The first IP address of the host */struct hostent *gethostbyname (const char *name);Obtain information such as host IP through hostname name. A hostent struct pointer that successfully returns the host name and address information for the g
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.