implementing the output codevoidWrite_routine (intSockChar*buf) { while(1) {fgets (buf, Buf_size, stdin); if(!STRCMP (BUF,"q\n") || !STRCMP (BUF,"q\n") {shutdown (sock, SHUT_WR); return; } write (sock, buf, strlen (BUF)); }}at the same time the multi-process server also has shortcomings, each creation of a process represents a large number of operations and memory space consumption, mutual process data exchange is also very troublesome ... So how to fix it, the blog behind me may give an ans
01. Introduction to network protocol for Linux network programming02, Linux Network Programming 2--no connection and connection-oriented protocol differences03. Programming 3--for
Today we talk about "pre-network programming". Content is miscellaneous, but all are in the network application development process often encounter problems. first, big, small, and network byte-orderSmall-endian byte-order: Little-endian, which stores the low byte at the starting address of the memory;Big endian byte o
/*************************************** **********************************> File name: addr_in.c> Author: Simba> Mail: dameng34@163.com> Created time: Fri 01 Mar 2013 04:16:08 pm CST**************************************** ********************************/# Include # Include Int main (void){Unsigned int ADDR = inet_addr ("192.168.0.100"); // The converted bytes are in the network byte sequence (large end)Printf ("add = % u \ n", nt
, SMTP, POP3 are text-based protocols for transparency (transparency).The second line of the HTTP header indicates the type of file to be sent (called the MIME type), here is the text/html, 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 more special: Usually the network com
system is assigned to the SCHED_RR process time slices, and then polls the process to run the process, putting the elapsed time slice to the end of the queue. Due to the existence of a variety of scheduling methods, Linux process scheduling using "conditional deprivation" scheduling mode. The common process is to use the Sched_other time slice polling method, the real-time process can deprive the ordinary process. If the normal process is running in
the string?What are the different states of a process in Linux? What symbols are represented in the information displayed by PS?18. How do I make a command run in the background?19. How do I display all the processes using PS? How do I use PS to view information for a specified process?20. Which command is dedicated to viewing background tasks?21. What commands do I use to move the background task to the foreground? What commands do I have to perform
Article title: Linux Network Driver programming (1 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1.
TCP segment or UDP segment, the TCP or UDP protocol then determines which user process should be given the application-tier data according to the port number field of the TCP header or UDP header. The IP address is the address that identifies different hosts on the network, and the port number is the address on the same host that identifies the different processes, and the IP address and port number together identify the only process in the
{in_addr_t s_addr;};(5)structSockaddr_in{__sockaddr_common (sin_); in_port_t Sin_port;/*Port number.*/structIN_ADDR sin_addr;/*Internet address.*//*Pad to size of ' struct sockaddr '.*/unsignedCharsin_zero[sizeof(structSOCKADDR)-__sockaddr_common_size-sizeof(in_port_t)-sizeof(structin_addr)];};(6) struct SOCKADDR This structure is the Linux network programming in
In order to complete the compilation first, the following steps are required:1. Go to the Linux subdirectory and perform make. (This step is patching.) )2, return to the previous level directory, open file simplec.c, add header file #include 3. Remove static from the static void set_address in the following file:Connectto.cTcpsink.c3. Perform make at the root directory.Carries mistake one:When doing Shutdownc/tcpecho experiments, the client SHUTDOWNC
Linux Network Programming socket options so_linger, so_reuseaddr
In Linux network programming, there are many socket options. Several of the most important options are: so_linger (only applicable to TCP and sctp), so_reuseaddr.
From http://blog.csdn.net/feiyinzilgd/article/details/5894300In Linux network programming, there are many options for sockets. Several of the more important options are: So_linger (only for TCP,SCTP), so_reuseaddr.
So_linger
By default, when you call close to close the use of Socke, close returns immediately, but if there is data in send buffer, the
sends a shutdown-answer segment to the server in response to a server shutdown.2.4 TCP socket programming for ProtocolsSocket programming is simply to make two or more networked computers exchanging data with one another.2.4.1 TCP The invocation of the primary function in the socket interface connectionThe function of the main call in the TCP socket interface connection is socket,bind,connect,write,listen,
Tags: INF application socket Selection SOC OSI for Linux network programming Linux Network1. Linux Network model①osi seven-tier model and Linux four-tier model② the relationship between
The IP address we usually use is a string of the type 192.168.1.11, and an IP address expressed in binary format in the Linux kernel. In programming, the conversion between IP addresses in string expression mode and binary IP addresses is often used.In the face of many address functions in network programming, do you h
Linux Network Programming 7 -- use TCP to implement mutual chat and linux Network ProgrammingIdeas
The main thread is responsible for sending messages, and the other thread is responsible for receiving messages. This is true for both the server and client.Note:
After Party A
Original articles, reproduced please indicate reproduced the words and sources, thank you!This gives an example of a simple socket network programming under Linux, communicates with the TCP protocol, listens on the server, sends the data to the client after receiving the client's connection, and the client prints and closes after receiving the data. There are det
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.