Scoket Low level networking interface(网络接口)
This module provides aceess to(接近,通路) the BSD socket interface. It is available on all modern Unix systems ,windows,Mac OS X ,BeOS ,OS/2 ,and probably additional platforms(平台).
Note:
Some behavior may be platform dependent ,since calls are made to the operating system socket APIs.
For an introduction to socket programming (int C), see the following papers :An introductory 4.3BSD interprocess Communication Tutorial, by Stuart Sechrest and An Advanced 4.3BSD interporcess Comu….
The Python interface is a straightforward transliteration(直译) of the Unix system call and library interface for sockets to Python’s object-oriented style : the socket() function returns a socket object whose methods implement(工具:执行:实现)the various socket system calls. Parameter types are somewhat higher-level than in the C interface : as with read() and write () operations on Python files , buffer allocation(分配) on receive operations is automatic , and buffer length is implicit(暗示,含蓄) on send operations.
Socket addresses are represented as follows : A single string is used for the AF_UNIX address family . A pair(host , port ) is used for the AF_INET address family where host is a string representing either a hostname in Internet domain notion like “daring.cwi.nl” or an IPv4 address like ‘100.50.200.5’, and port is an integer. For AF_INET anddresss family ,a four-tuple(host ,port,flowinfo ,scopeid) is used, where flowinfo and scopeid represents sin6_flowinfo and sin6_scope_id member in struct sockaddr_in6 in C . For soc