|
楼主 |
发表于 2009-9-1 16:15:38
|
显示全部楼层
回复 #6 psycheqiqi 的帖子
写文件正常
但读文件时出现
recv:Resource temporarily unavailable
代码:
char *buf="12345";
ssize_t len = ACE_OS::strlen (buf) + 1;
if (file.send (buf, len-1) != len-1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
"send"),
1);
if (file.get_info (&fileinfo) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
"get_info"),
1);
else
ACE_OS::printf ("fileinfo : mode = %o\nno of links = %lu\nsize = %lu\n",
(u_int) fileinfo.mode_ & 0777,
ACE_static_cast(u_long ,fileinfo.nlink_),
(u_long) fileinfo.size_);
ACE_TCHAR *readback = new ACE_TCHAR[len + 1];
if (file.recv (readback, len) != len)
{
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
"recv"),
1);
}
printf("-----");
ACE_OS::printf ("read back :%s\n",
readback);
if (file.close () == -1)
ACE_ERROR_RETURN ((LM_ERROR,
"%p\n",
"close"),
1); |
|