/ * Use Mmap to operate the file * /#include #include #include #include #include #include #define FILELENGTHintMainvoid){intFD =-1;/ * The string that will be written to the file * / Charbuf[]="Quick brown fox jumps over the lazy dog";Char*ptr = NULL;/* Open the file mmap.txt and reduce the file length to 0, create it if the file does not exist, and read/write the permission to execute */FD = open ("Mmap.txt", O_RDWR/* Readable/writable */| O_creat/ * Does not exist, created * /| O_trunc/ * Zoo
=" 5e77f7febc844f91a443d168d01bd849.png "/>Step 9: After the target table is determined, we can choose an import mode, that is append or overwrite, after the selection is complete, the next step650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/08/9a50d5770d8ccd7971736dee925436fc.png "style=" float: none; "title=" QQ picture 20171108143400.png "alt=" 9a50d5770d8ccd7971736dee925436fc.png "/>Step 10: Click to start, the following interface, pay attention to error or abnormal information.
, the plain text file is Text/plain, the picture is Image/jpg, image/png, and so on.Then send the contents of the file, after sending the active close connection, so that the browser will know that the file has been sent. This is very special: usually the network communication is the client initiates the connection, initiates the request, actively shuts down the connection, the server only passively handles the various situations, and the HTTP protoco
to transmit the data and receive the data using the RECV system call. Typically, the customer uses Send to send the request, and the server sends the answer using send. the server uses RECV to receive requests sent by the client with a send call. The customer receives the answer with RECV after the request is made. calling send requires three parameters: the socket descriptor to which the data is destined, the address of the data to be sent, and the length of the data. calling recv requires thr
, the old and new two different frames are fitted.RTMP gives different priority levels to the data. In real-time conversations, the sound is the most important, the image is given a low priority, and the script data is given priority over the middle of the sound and the image.The RTMP protocol can create multiple data streams, but each data flow can have only one direction.With rtmp, you can build a system that allows clients to interact with the RTMP server and the application server at the sam
1. PrefaceI have been engaged in the network development of Linux for nearly 4 years, often still encountered some problems, but do not know the reason why, and sometimes communicate with other people, make very awkward. Now the computer is multicore, the network programming framework is gradually enriched, I know that
first, the network programming socket API operation meaning
Api
Blocking
Non-blocking
Connect
TCP three times handshake succeeds and returns.
Returns immediately, and other ways are needed to determine whether a TCP connection has been established successfully or failed.
Send
Block until the pending data is sent from the user space into the kernel sen
Linux Platform QT Database ProgrammingIn the Linux platform using QT to write GUI programs, in the database programming, there are two options, namely: Linux platform-based database interface function programming, the other is the use of QT comes with the relevant database c
("Listen failed! Error message:%s\n", Strerror (errno)); GotoEND; } intclient_st=0;//client-side socket structSockaddr_in clientaddr;//IP address of client side Charbuf[1024x768]={0}; intI=0; while(i1) {memset (AMP;CLIENTADDR,0,sizeof(CLIENTADDR)); socklen_t Len=0;//maximum number of bytes representing the client address /*Accept will block the current thread until a client connects, and the Accept () function returns the socket descriptor on the client side*/Client_st=accept (
to the callback function on each FD, only the active socket will actively invoke callback, so in the case of less active sockets, using Epoll does not have a performance problem with the linear descent of the preceding two. However, when all sockets are active, there may be performance issues.
3. Message Delivery method
Select
The kernel needs to pass the message to the user space, requiring the kernel copy action
Poll
Ditto
Epo
destination is not damaged by the network during transmission.second , it assigns a sequence number to each byte, so that if the data arrives at the destination, it is really wrong, and the receiving side can reload it in the proper order. Of course, TCP does not have a serial number attached to each byte. In fact, the header of each TCP segment includes the sequence number of the first byte in the segment. In this way, the sequence number of the oth
, you can use the GETHOSTBYADDR function to find out which host has a given IP address, and you can use this function on the server to locate the source of the connecting customer.Program parsingThe getname program extracts the host's information from the host database by calling GetHostByName. It prints out the host name, its alias, and the IP address that the host uses on its network interface. Run this program and specify the hostname of Google, th
network programming commonly used to bind function, you need to bind the IP address, you can set Inaddr_any Inaddr_any is the designated address 0.0. 0 address, which in fact represents an indeterminate address, or "all addresses", "arbitrary addresses". That is to say that all the IP, because some of the machine more than one network card, multi-card case, this
Network ' s JavaScript guideEssential Javascript jQuery Design Patterns for BeginnersLatexThe Introduction to LATEX (perfect for beginners is especially suitable for beginners)LinuxAdvanced Linux ProgrammingLispA Gentle Introduction to Symbolic computation (PDF)Practical Common LispOn LispANSI Common LispCommon Lisp the Language, 2nd EditionSuccessful LispLet over lambda–50 years of LispNatural Language p
Network Programming (1) -- easy understanding of network resource positioning and Network Programming Network Resources
It sounds very difficult to learn network
; Waitpid feature rich, parameter PID can specify the specific subroutine, the parameter options set to Wnohang, even if the PID of the child process of the termination state can not be immediately obtained, It does not cause a zombie process.5. The child process becomes a zombie process when the parent process does not capture the signal of the child process, causing the other child processes to become blocked.6.I/O mode: Blocking I/O mode (socket default), non-blocking I/O mode (polling), I/O
Through the Linux network programming-the original socket programming, we know that we can get the link layer packets through the raw sockets and recvfrom (), what is the link layer Packet we receive ?Link Layer envelope formatMAC head (wired LAN)Note: CRC, PAD can be ignored when group packageOne of the scenarios of a
rio_buf[rio_bufsize];/*internal bu f*/}rio_t;initializes the buffer (in effect, the buffer is associated with the network descriptor FD).Rio_initNot open a file descriptive descriptors are called once Rio_initvoid Rio_readinitb (rio_t *rp,int fd) { rp->rio_fd = FD; rp->rio_cnt = 0; Rp->rio_bufptr = Rp->rio_buf;}Rio_read (read with buffered version number, and Unix read ( not encapsulated ) with identical effect)Static ssize_t Rio_read (rio_t
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