getsockname()/getpeername()函数第一次被调用得到0.0.0.0结果
2024-08-26 08:15:04
int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
getsockname() returns the current address to which the socket sockfd is bound,in the buffer pointed to by addr. The addrlen argument should be initialized to indicate the amount of space (in bytes) pointed to by addr. On return it contains the actual size of the socket address.
The returned address is truncated if the buffer provided is too small; in this case, addrlen will return a value greater than was supplied to the call.
通过手册说明,可以看到addrlen参数所指的对象必须初始化,另外,如果初始提供的值太小,getsockname()函数在返回时,新写入addrlen指向的对象的值将会大于所调用时提供的值。
最新文章
- 【python】点分十进制ip与数字互转
- 一个简单的物料防错DEMO
- 按月统计tcode和report使用次数的工具
- empty()、html(";";)和text(";";)
- Redis常用方法
- idea类似eclipse鼠标提示java api信息
- GlusterFS创建volume失败的解决方法(* or a prefix of it is already part of a volume)
- GIT 分支的理解
- perl 创建文本框
- HTML表格表单综合——用户注册表
- JavaScript的兼容
- CDH集成Kafka,两种方式:离线、在线
- nuget包管理nuget服务器发布包时出现请求报错 406 (Not Acceptable)
- 使用git将本地项目推送到码云私有仓库
- windows下《Go Web编程》之Go命令
- Spark架构
- ftp不能登录报错
- html实体转换
- 微信公众号access_token的获取与存储
- 安装和使用mongodb