- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
进程间通讯有名管道(Interprocess communication is named pipe)
进程间通讯有名管道(Interprocess communication is named pipe) 一。服务器 #包括 stdio. h #包括 Afxwin. H #包括 afxext。” #包含iostream / / #包括“/ npipe。” 使用名称空间; 处理m_hpipe; 原m_smessage; 单位readproc(); 无效main() { (1) { m_hpipe = CreateNamedPipe(“\\\\。\管\测试”,pipe_access_duplex,pipe_type_byte | pipe_readmode_byte,1, 0, 0,1000,null);/ /创建命名管道 如果(m_hpipe = = invalid_handle_value) { m_smessage =“创建命名管道失败!”; printf(“%s”,m_smessage。GetBuffer(0)); } 其他的 { m_smessage =“成功创建命名管道!”; / / afxbeginthread(readproc,这开启线程);/ / 微量(m_smessage); printf(“%s”,m_smessage。GetBuffer(0)); readproc(); } } } 单位readproc() { 字符串缓冲区[ 1024 ];//数据缓存 DWORD readnum; memset(缓冲区,0,sizeof(char)* 1024); printf(“zhanghui_1 \n”); 如果(connectnamedpipe(m_hpipe,null)= = false)/等待客户机的连接 { printf(“zhanghui_2 \n”); CloseHandle(m_hpipe);/ /关闭管道句柄 m_smessage =“与客户机建立连接失败!”;//显示信息 printf(“%s”,m_smessage。GetBuffer(0)); 返回0; } 其他的 { m_smessage =“与客户机建立连接!”;//显示信息 printf(“%s”,m_smessage。GetBuffer(0)); } / /从管道读取数据 如果(ReadFile(m_hpipe,缓冲,sizeof(缓冲区),与readnum,null)= = false) { CloseHandle(m_hpipe);/ /关闭管道句柄 m_smessage =“从管道读取数据失败!”;//显示信息 printf(“%s”,m_smessage。GetBuffer(0)); } 其他的 { 缓冲[ readnum ] =“0”;/ /显示接收到的信息 m_smessage = CString(缓冲区); printf(“%s”,m_smessage。GetBuffer(0)); CloseHandle(m_hpipe);/ /关闭管道句柄 } 返回1; } 二。客户端 #包括AFX。” #包括Windows。” #包含iostream 使用名称空间; 字符串m_smessage; void main(int argc、argv char * [ ]) { 字符串消息=“MAC = 102.2.345;IP = 192.168.8.9;”;/ /要发送的数据 DWORD WriteNum; / / send data length / / wait for the connection to the server If (WaitNamedPipe (\\\\.\\Pipe\\Test, NMPWAIT_WAIT_FOREVER) = FALSE) { M_sMessage = waiting for the connection failed!; / / display information //printf (%s, m_sMessage.GetBuffer (0)); Printf (%s, m_sMessage.c_str ()); Return; } Open the pipe / handle has been created HANDLE, hPipe = CreateFile (\\\\.\\Pipe\\Test, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); If (hPipe = INVALID_HANDLE_VALUE) { M_sMessage = open piping failure!; / / display information //printf (%s, m_sMessage.Ge
您可能关注的文档
- 英国留学选择什么样的老板作导师(Study in the UK what kind of boss do you choose as a mentor).doc
- 英国报纸发展(British newspaper development).doc
- 英文中姓氏的含义(The meaning of surnames in English).doc
- 英国发现淋球菌出现抗药性 未来淋病或无法治愈(Neisseria gonorrhoeae is resistant to future gonorrhea or incurable in Britain).doc
- 英文名言警句(English aphorism).doc
- 英文实用语句(English utility statement).doc
- 苏州河沿岸地区更新改造城市设计 - abbs论坛(Urban renewal design of the Suzhou River coastal area - ABBS Forum).doc
- 英文经典名句(English classic).doc
- 英文自我介绍及导师常问问题(Introduce yourself in English and ask questions from your supervisor).doc
- 英语六级快速阅读(English six speed reading).doc
- 追述伪满首都警察厅旧址的变迁(The Metropolitan Police Department in change of the site).doc
- 送给渴望成功的教师的十句话(Ten sentences to a teacher eager to succeed).doc
- 送职方郎中王君赴任序(明)金实(Doctor Wang Jun sent staff to order (Ming) Jin Shi).doc
- 适合大学生的早餐店创业计划书(A breakfast shop proposal for College Students).doc
- 适配不同分辨率横屏竖屏 android安卓开发(Adaptation of different resolutions, horizontal screen, vertical screen, Android, Android development).doc
- 选修课表(Elective timetable).doc
- 选秀女制度(Talent show system).doc
- 选购冰箱小知识(Little knowledge of refrigerator).doc
- 透穴针法临证谈(Discussion on acupuncture treatment of acupuncture point through acupuncture point).doc
- 透过仓库窥视客户的管理能力(Peek through the warehouse for customer management capabilities).doc
最近下载
- 中式烹调师高级工理论知识练习题库(附参考答案).docx
- 中央厨房卫生规范与管理指南.docx VIP
- 2025年人工智能工程师(高级)题库.docx VIP
- 社会团体成立登记表.docx
- MITSUBISHI三菱MDS-EM EMH系列规格说明书.pdf
- 高血压科普健康宣教ppt课件.pptx VIP
- 2025入党积极分子发展对象考试题库(含答案).pdf VIP
- YD-T 4244-2023电信网和互联网数据分类分级技术要求与测试方法.pdf VIP
- 2025年新版成人考试模拟真题及答案.doc VIP
- 0523S01019-理解当代中国:汉英翻译-2023版人才培养方案课程教学大纲.docx VIP
文档评论(0)