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指向的对象的值将会大于所调用时提供的值。

最新文章

  1. 【python】点分十进制ip与数字互转
  2. 一个简单的物料防错DEMO
  3. 按月统计tcode和report使用次数的工具
  4. empty()、html("")和text("")
  5. Redis常用方法
  6. idea类似eclipse鼠标提示java api信息
  7. GlusterFS创建volume失败的解决方法(* or a prefix of it is already part of a volume)
  8. GIT 分支的理解
  9. perl 创建文本框
  10. HTML表格表单综合——用户注册表
  11. JavaScript的兼容
  12. CDH集成Kafka,两种方式:离线、在线
  13. nuget包管理nuget服务器发布包时出现请求报错 406 (Not Acceptable)
  14. 使用git将本地项目推送到码云私有仓库
  15. windows下《Go Web编程》之Go命令
  16. Spark架构
  17. ftp不能登录报错
  18. html实体转换
  19. 微信公众号access_token的获取与存储
  20. 安装和使用mongodb

热门文章

  1. (F. MST Unification)最小生成树
  2. j2ee组件简介
  3. Interval Sum I && II
  4. Linux中断(interrupt)子系统之四:驱动程序接口层 & 中断通用逻辑层【转】
  5. Linux硬盘的检测(原创)
  6. jquery-事件之页面框架加载后自动执行
  7. vector的reserve和resize(转)
  8. 算法笔记(C++)
  9. HTML5练习4
  10. poj 1611 求0号结点所在集合的元素个数