Python Sokcet 文档翻译

该模块提供了对BSD套接字接口的访问,适用于各种平台。本文档详细介绍了Python中socket模块的方法,包括gethostbyname、gethostbyname_ex、gethostname和gethostbyaddr等,这些方法实现了操作系统套接字API的调用。对于IPv4和IPv6地址,使用字符串表示,如空字符串代表INADDR_ANY,'broadcast'代表INADDR_BROADCAST。注意,使用主机名而非数值地址可能导致非确定性行为,建议使用数值地址以确保一致性。
摘要由CSDN通过智能技术生成
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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值