如何在VC ++ / C ++中编写简单的异步tcp服务器客户端通信程序 [英] How to code a simple asynchronous tcp server client communication program in VC++/C++
本文介绍了如何在VC ++ / C ++中编写简单的异步tcp服务器客户端通信程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要编写一个服务器和一个使用tcp和异步通信进行通信的客户端。我希望只使用基本的api来实现它,比如createsocket(),listen(),connect(),bind()等.CAsyncSocket可用,但那是MFC,我正在寻找基本的帮助相关的windows api .....
I need to code a server and a client that communicates using tcp and an asynchronous communication. I wish to implement it with only the basic api's like createsocket(), listen(), connect(), bind() etc. CAsyncSocket is available but that's MFC and I am looking for basic help related windows api.....
推荐答案
CodeProject有关于此主题的任意数量的文章。有任何复杂的客户端/服务器示例。
从这里开始,虽然作者使用MFC作为应用程序,套接字的东西是纯win32。
开始Winsock编程 - 简单的TCP客户端 [ ^ ]
开始Winsock编程 - 简单的TCP服务器 [ ^ ]
这是一篇好文章:
http://www.win32developer.com/tutorial/winsock/winsock_tutorial_6.shtm [ ^ ]
这可能是有意义的:
基于事件的套接字Streams:SocketLib [ ^ ]
CodeProject has any number of articles on this subject. There are client/server examples of any complexity.
Start here, although the author uses MFC for the application the socket stuff is pure win32.
Beginning Winsock Programming - Simple TCP client[^]
Beginning Winsock Programming - Simple TCP server[^]
This is a good article:
http://www.win32developer.com/tutorial/winsock/winsock_tutorial_6.shtm[^]
This may be of interest:
Event Based Socket Streams: SocketLib[^]
除了pwasser指定的链接代码外,以下基本信息也可以为您提供帮助。
Winsock入门 [ ^ ]
为Ser创建一个Socket ver [ ^ ]
为客户端创建一个套接字 [ ^ ]
Apart from the code from the links specified by pwasser, following basic information also may help you.
Getting Started with Winsock[^]
Creating a Socket for the Server[^]
Creating a Socket for the Client[^]
这篇关于如何在VC ++ / C ++中编写简单的异步tcp服务器客户端通信程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文