⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.cpp

📁 用c++编写的网络通信框架
💻 CPP
字号:
// client.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "socket.h"

int main(int argc, char* argv[])
{
	xuwn::client c;

	while (TRUE)
	{
		if (!c.Init("127.0.0.1", 6666))
		{
			::printf("Init error code: %d\n", c.code);
			continue;
		}

		if (TRUE != c.Connect())
		{
			::printf("Connect error code: %d\n", c.code);
			continue;
		}

		for (int i = 0; i < 10000; i++)
		{
			char buf[128];
			::memset(buf, 0, sizeof(buf));

			::sprintf(buf, "0004%04d", i);

			int rc = ::send(c.GetSocket(), buf, ::strlen(buf), 0);

			Sleep(10);
		}

		c.Close();
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -