Python pen questions (-)

Source: Internet
Author: User
Tags ack dns2 domain name server browser cache domain server

1How do I see what process is taking 8080 ports? NETSTAT–APN| grep 80802. What is the DNS parsing process?    There are several analytic ways, what is the difference? 1Browser Cache When a user accesses a domain name through a browser, the browser will first look in its own cache for the IP address of that domain name (if it has ever visited the domain and has not emptied the cache);2system cache When the browser cache does not have a domain name corresponding IP will automatically check the user computer system Hosts file DNS cache if there is a corresponding IP domain name;3) Router cache when the browser and the system cache do not have a domain name corresponding IP is entered into the router cache check, the above three steps are the client side of the DNS cache;4ISP (Internet service provider) DNS cache when the domain name corresponding IP address is not found on the customer service side, it will be queried in the ISP DNS cache. For example, you use a telecommunications network, you will enter the telecommunications DNS cache server to find;5root domain server when none of the above is complete, go to the root server for queries.    There are only 13 root name servers, 1 primary root nameservers, and the remaining 12 are secondary root nameservers. When a root domain receives a request, the zone file record is viewed and, if none, the top-level domain name (such as. com) server IP within its jurisdiction is told to the local DNS server;6The top-level domain Server top-level domain server receives a request to view the zone file record, and if none, tells The local DNS server the IP address of the primary domain name server within its jurisdiction;7The primary name server primary Domain name server accepts the request to query its own cache, if not go to the next level of domain name server to find, and repeat the step until the correct record is found;8Save the result to the cache the local name server saves the returned result to the cache for the next use, and then feeds the result back to the client, which is linked to the Web server via this IP address. 1recursive query: The general client and the server is a recursive query, that is, when the client sends a request to the DNS server, if the DNS server itself can not be resolved, the other DNS server will be issued a query request, the results are forwarded to the client;2. Iterative query (repeated query): The General DNS server is an iterative query, such as: if DNS2 can not respond to DNS1 's request, it will DNS3 IP to DNS2, so that it can send a request to DNS3;3./temp is mounted on a single partition and is now found to be full of disk space and too many small files.  Now please delete all files with the command? Umount/Temp Fidsk/temp-m-D 1-W4.  What is the process for TCP to establish a three-time handshake and disconnect four handshakes? Three-time handshake: (1) Host A sends a TCP connection request packet to Host B, which contains the initial sequence number of host a seq (a) =x. (where the synchronous flag bit SYN in the message=1,ack=0, which indicates that this is a TCP connection request data message: Serial number seq=x, indicating that the ordinal of the first data byte when the data is transmitted is X);2when Host B receives the request, it sends back the connection acknowledgement packet. (which identifies the bit in the message segment, the SYN=1,ack=1, which indicates that this is a TCP connection response data packet, and contains the initial sequence number seq (b) =y of Host B, and the acknowledgment number of Host B for the initial serial number of host A ack (b) =seq (A) +1=x+1) (3) The third time, host a received the confirmation message from Host B, also need to make confirmation, that is, send a serial number seq (a) =x+1; confirmation number is ack (a) =y+1 message; four-time handshake: Assuming that host A is the client and Host B is the server, the process of releasing the TCP connection is as follows: (1) Close the client-to-server connection: First, client A sends a fin to turn off the client-to-server data transfer, and then waits for the server to confirm. Where stop flag bit fin=1, serial number seq=U (2the server receives this fin, and it sends back an ACK, confirming the ACK number to the received sequence number plus 1. (3) Close the server to the client connection: Also send a fin to the client. (4after the customer segment receives FIN, it returns an ACK message acknowledgment and confirms that the ordinal seq is set to receive the serial number plus 1. The first party to close will perform an active shutdown, while the other side performs a passive shutdown. 5. Write a script that handles the following text content, takes the domain name out, and counts the sort http:www.immomo.com/index.html http:club.immomo.com/small_552.htm http:news.immomo.com/dzjk/nrsj/http:www.immomo.com/il_sii_3803.htm http:www.immomo.com/test.php http:club.immomo.com/big_303.htm The following results: www.immomo.com club.immomo.com news.immomo.com using bash/perl/python/ruby/any language in PHPImportre with open ('a.txt','R') as F:file_all=f.read () result=re.findall (R'http://(. *com?)', File_all) forIinchSet (Result):Print(i)6. Linux Command:free, as follows: $free-m total used free shared buffers cached Mem:3832 1188 2644 0 257 666-/+buffers/cache:264 3568Swap:7999 0 7999excuse me, what do you mean by swap,total,free,shared,buffers,cached? Swap: Indicates the usage of the swap partition on the hard disk total: Indicates that the amount of physical memory that the system can use is 3832 free: represents the allocated physical memory as 232 shared: The total amount of memory shared by multiple processes buffers: not used by system allocation Buffer Memory 257 Cached: The cache memory that has been allocated but not used is 6667what is the adorner in Python and how to use it? An adorner is essentially a Python function or class that allows other functions or classes to add extra functionality without any code modification, and the return value of the adorner is also a function/class object using: @+The adorner function is written on top of the decorated function.deflog (level):defDec (func):defWrapper (*args,**Kwargs):Print "before Func was called"func (*args,**Kwargs)Print "After func is called"            returnwrapperreturnDec @log (2)    defFunclog ():Print "Funclog was called"Funclog ()==>before Func was Calledfunclog is Calledafter func was called8. Illustrate list/dict/in Python, respectivelyset comprehensions. List:[x(*p forXinchRange (10)] Dict:strings=['Workhard',' is','Important'] D={key:val forVal,keyinchEnumerate (Strings)} set:{x(*p forXinch[1, 1, 2]} 9How can I read a 20GB size file effectively in Python? File name: A.text with open ('A.text','R', encoding='Utf-8') as F: forLineinchf:do_something (line)10. Implement a stack using Python. classStack (object):def __init__(self): Self.items=[]        defIs_empty (self):returnSelf.items = = []        defPeek (self):returnSelf.items[len (Self.items)-1]        defsize (self):returnLen (self.items)defpush (Self,items): Self.items.append (item)defPop (self,item):returnSelf.items.pop ()if __name__==__main__: My_stack=Stack () My_stack.push ('a') My_stack.push ('b')        Print(My_stack.size ())Print(My_stack.peek ())Print(My_stack.pop ())Print(My_stack.peek ())Print(My_stack.size ())Print(My_stack.pop ())Print(My_stack.size ())

Python pen questions (-)

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.