当前位置: 首页 > news >正文

网站开发的目标百度关键词排名怎么做

网站开发的目标,百度关键词排名怎么做,好看欧美视频网站模板下载 迅雷下载 迅雷下载地址,关于文化的网站模板我正在移植构建在ACE Proactor框架之上的应用程序.该应用程序适用于VxWorks和Windows,但在使用librt的内核2.6.X.X的Linux(CentOS 5.5,WindRiver Linux 1.4和3.0)上无法运行.我把问题缩小到一个非常基本的问题#xff1a;应用程序在套接字上开始异步(通过aio_read)读取操作,然…我正在移植构建在ACE Proactor框架之上的应用程序.该应用程序适用于VxWorks和Windows,但在使用librt的内核2.6.X.X的Linux(CentOS 5.5,WindRiver Linux 1.4和3.0)上无法运行.我把问题缩小到一个非常基本的问题应用程序在套接字上开始异步(通过aio_read)读取操作,然后在同一个套接字上开始异步(通过aio_write)写入.由于协议是从应用程序结束初始化的,因此无法实现读取操作.– 当套接字处于阻塞模式时,永远不会写入并且协议“挂起”.– 使用O_NONBLOCK套接字时,写入成功,但读取无限期地返回“EWOULDBLOCK / EAGAIN”错误,永远不会恢复(即使重新启动AIO操作).我经历了多个论坛,无法找到一个明确的答案,说明这是否应该可行(而且我做错了)或Linux AIO不可能.是否可以放弃AIO并寻求不同的实现(通过epoll / poll / select等)附件是一个示例代码,可以在非阻塞套接字上快速重现问题#include #include #include #include #include #include #include #include #include #include #define BUFSIZE (100)// Global variablesstruct aiocb *cblist[2];int theSocket;void InitializeAiocbData(struct aiocb* pAiocb, char* pBuffer){bzero( (char *)pAiocb, sizeof(struct aiocb) );pAiocb-aio_fildes theSocket;pAiocb-aio_nbytes BUFSIZE;pAiocb-aio_offset 0;pAiocb-aio_buf pBuffer;}void IssueReadOperation(struct aiocb* pAiocb, char* pBuffer){InitializeAiocbData(pAiocb, pBuffer);int ret aio_read( pAiocb );assert (ret 0);}void IssueWriteOperation(struct aiocb* pAiocb, char* pBuffer){InitializeAiocbData(pAiocb, pBuffer);int ret aio_write( pAiocb );assert (ret 0);}int main(){int ret;int nPort 11111;char* szServer 10.10.9.123;// Connect to the remote servertheSocket socket(AF_INET, SOCK_STREAM, 0);assert (theSocket 0);struct hostent *pServer;struct sockaddr_in serv_addr;pServer gethostbyname(szServer);bzero((char *) serv_addr, sizeof(serv_addr));serv_addr.sin_family AF_INET;serv_addr.sin_port htons(nPort);bcopy((char *)pServer-h_addr, (char *)serv_addr.sin_addr.s_addr, pServer-h_length);assert (connect(theSocket, (const sockaddr*)(serv_addr), sizeof(serv_addr)) 0);// Set the socket to be non-blockingint oldFlags fcntl(theSocket, F_GETFL) ;int newFlags oldFlags | O_NONBLOCK;fcntl(theSocket, F_SETFL, newFlags);printf(Socket flags: before%o, after%o\n, oldFlags, newFlags);// Construct the AIO callbacks arraystruct aiocb my_aiocb1, my_aiocb2;char* pBuffer new char[BUFSIZE1];bzero( (char *)cblist, sizeof(cblist) );cblist[0] my_aiocb1;cblist[1] my_aiocb2;// Start the read and write operations on the same socketIssueReadOperation(my_aiocb1, pBuffer);IssueWriteOperation(my_aiocb2, pBuffer);// Wait for I/O completion on both operationsint nRound 1;printf(\naio_suspend round #%d:\n, nRound);ret aio_suspend( cblist, 2, NULL );assert (ret 0);// Check the error status for the read and write operationsret aio_error(my_aiocb1);assert (ret EWOULDBLOCK);// Get the return code for the read{ssize_t retcode aio_return(my_aiocb1);printf(First read operation results: aio_error%d, aio_return%d - Thats the first EWOULDBLOCK\n, ret, retcode);}ret aio_error(my_aiocb2);assert (ret EINPROGRESS);printf(Write operation is still \in progress\\n);// Re-issue the read operationIssueReadOperation(my_aiocb1, pBuffer);// Wait for I/O completion on both operationsprintf(\naio_suspend round #%d:\n, nRound);ret aio_suspend( cblist, 2, NULL );assert (ret 0);// Check the error status for the read and write operations for the second timeret aio_error(my_aiocb1);assert (ret EINPROGRESS);printf(Second read operation request is suddenly marked as \in progress\\n);ret aio_error(my_aiocb2);assert (ret 0);// Get the return code for the write{ssize_t retcode aio_return(my_aiocb2);printf(Write operation has completed with results: aio_error%d, aio_return%d\n, ret, retcode);}// Now try waiting for the read operation to complete - itll just busy-wait, receiving EWOULDBLOCK indefinitelydo{printf(\naio_suspend round #%d:\n, nRound);ret aio_suspend( cblist, 1, NULL );assert (ret 0);// Check the error of the read operation and re-issue if neededret aio_error(my_aiocb1);if (ret EWOULDBLOCK){IssueReadOperation(my_aiocb1, pBuffer);printf(EWOULDBLOCK again on the read operation!\n);}}while (ret EWOULDBLOCK);}提前致谢,Yotam.解决方法:首先,O_NONBLOCK和AIO不混合.当相应的读或写不会被阻塞时,AIO将报告异步操作完成 – 并且使用O_NONBLOCK,它们永远不会阻塞,因此aio请求将始终立即完成(使用aio_return()给出EWOULDBLOCK).其次,不要为两个同时发生的未完成的aio请求使用相同的缓冲区.在发出aio请求的时间和aio_error()告诉你已完成的时间之间,缓冲区应被视为完全禁止.第三,AIO对同一文件描述符的请求排队,以便给出明智的结果.这意味着在读取完成之前不会发生写入 – 如果您需要先写入数据,则需要以相反的顺序发出AIO.以下工作正常,无需设置O_NONBLOCKstruct aiocb my_aiocb1, my_aiocb2;char pBuffer1[BUFSIZE1], pBuffer2[BUFSIZE1] Some test message;const struct aiocb *cblist[2] { my_aiocb1, my_aiocb2 };// Start the read and write operations on the same socketIssueWriteOperation(my_aiocb2, pBuffer2);IssueReadOperation(my_aiocb1, pBuffer1);// Wait for I/O completion on both operationsint nRound 1;int aio_status1, aio_status2;do {printf(\naio_suspend round #%d:\n, nRound);ret aio_suspend( cblist, 2, NULL );assert (ret 0);// Check the error status for the read and write operationsaio_status1 aio_error(my_aiocb1);if (aio_status1 EINPROGRESS)puts(aio1 still in progress.);elseputs(aio1 completed.);aio_status2 aio_error(my_aiocb2);if (aio_status2 EINPROGRESS)puts(aio2 still in progress.);elseputs(aio2 completed.);} while (aio_status1 EINPROGRESS || aio_status2 EINPROGRESS);// Get the return code for the readssize_t retcode;retcode aio_return(my_aiocb1);printf(First operation results: aio_error%d, aio_return%d\n, aio_status1, retcode);retcode aio_return(my_aiocb1);printf(Second operation results: aio_error%d, aio_return%d\n, aio_status1, retcode);或者,如果您不关心相互之间的读取和写入,您可以使用dup()为套接字创建两个文件描述符,并使用一个用于读取而另一个用于写入 – 每个都将具有AIO操作单独排队.标签linux,sockets,kernel,nonblocking,aio来源 https://codeday.me/bug/20190630/1340573.html
http://www.zqtcl.cn/news/809894/

相关文章:

  • 手机商城手机网站建设多少钱明水县网站建设
  • 北京网站优化外包做板材外贸一般用哪个网站
  • 北京建设网站有哪些公司药店网站模板
  • 网站欢迎页面怎么做个人简历免费模板下载
  • 宁波外贸网站建设竣工验收报告查询网
  • 内衣网站建设详细方案如何制作企业网站的版式
  • 网站建设是否需要源代码php如何制作网站
  • 自响应式网站是什么意思现货交易平台合法的有几家
  • 网站如何做视频链接地址一个虚拟主机空间挂两个网站
  • seo外贸网站建设常州本地网站
  • 可以做机械设计接单的网站pc网站怎么做自适应
  • 网站建设义乌电子商务做网站实训体会
  • 哪些网站做国际贸易比较好徐州泉山建设局网站
  • 平果县免费网站哪家好新媒体营销
  • 网站制作的页面比例企业为什么建立企业网站
  • 网站开发技术的发展专业的seo网站优化公司
  • 十大ppt模板免费下载网站惠州网络营销
  • 网站建设自优化网站首页
  • 网络营销推广方式包括哪几种湘潭网站seo磐石网络
  • 英文WordPress站点切换为中文优化神马网站关键词排名价格
  • 宁波网站建设免费咨询网站建设服务费怎么做会计分录
  • 工作期间员工花钱做的网站wordpress文章内容乱码
  • 艺术设计招聘网站多用户商城网站方案
  • 杭州最大的网站开发有多少专门做兼职的网站
  • 萍乡做网站的公司做偏门网站
  • 成都网站开发价格企业网站管理系统破解版
  • 郑州新闻头条最新消息百度小程序关键词优化
  • 甘肃省通信管理局网站北京软件开发公司排名前十强
  • 用现成的网站模板只套内容就可以有这样的吗忻府网站建设排名
  • 网站设计结果泸州市住房和城乡建设厅官方网站