免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5905 | 回复: 5
打印 上一主题 下一主题

flush()函数问题。 [复制链接]

Basin 该用户已被删除
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-03-07 08:44 |只看该作者 |倒序浏览
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
2 [报告]
发表于 2006-09-26 10:38 |只看该作者
我也想问这个问题 帮忙回答一下 谢谢

论坛徽章:
0
3 [报告]
发表于 2006-09-26 10:41 |只看该作者
清空buffer

论坛徽章:
0
4 [报告]
发表于 2006-09-26 18:26 |只看该作者
原帖由 Basin 于 2006-3-7 08:44 发表
[code]#!c:\perl\bin\perl.exe
use IO::Socket;
...
$sock->flush();
}
close($sock)
这是高级perl编程中的一段代码,最后的$sock->flush()是什么意思?函数flush()是模块Socket或者INET的函数吗?有什么作用?谢谢解答


Hallo,
here $sock->flush() is obj. $sock to call method flush() from the top package IO::Handle.
see perldoc IO::Handle:

$io->flush
           "flush" causes perl to flush any buffered data at the perlio api level.  
           Any unread data in the buffer will be discarded, and any unwritten data will be written
           to the underlying file descriptor. Returns "0 but true" on success, "undef" on error.

regards, ulmer

[ 本帖最后由 ulmer 于 2006-9-26 18:28 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-09-26 18:37 |只看该作者
ulmer is right.Perl 5.6以后的IO::Socket对象,默认都是autoflush的,不用调用flush方法也行。

论坛徽章:
0
6 [报告]
发表于 2006-09-27 14:59 |只看该作者
thanks i remember
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP