有一个strlen的,和wcslen功能,但有一个模板字符数组长度的功能,所以你可以做这样的事情strlen<char>
还是strlen<wchar_t>
?
如果没有,那么我想我会写自己的.
我正在使用Winsocks 2.2编写一个使用Visual Studio 2010的C++网络游戏,并决定使用我的网络服务器存储游戏的活动服务器列表是个好主意.当服务器启动时,它将在我的Web服务器上注册,退出时取消注册; 当有人访问服务器列表时,服务器本身将尝试清理列表(这种行为我仍在设计不涉及服务器上的太多工作;但我想当游戏服务器试图添加自己时,我的php文件将使用fsockopen来检测它是否可以从外部网络实际访问服务器,如果没有,服务器将无法添加,直到它可以正确设置端口转发或以某种方式解决问题).
好的,经过一些研究,我想出了如何使用TCP连接从服务器获取某些东西来格式化HTTP服务器的专用消息.这就是我所拥有的:
if(FAIL == Connection::Get_Connection(&m_Connection, networkSettings.ServerListAddress, 80))
{
return FAIL;
}
m_Connection.SendMsg("GET /servers.php HTTP/1.1\r\nHost: cyclotron.leetnightshade.com\r\nUser-Agent: CycloTron\r\n\r\n");
Run Code Online (Sandbox Code Playgroud)
我期待回到格式正确的数据,我并没有完全得到.这是我得到的:
2f
Server Count:1
129.21.138.1,40000,Depth of Hell
0
Run Code Online (Sandbox Code Playgroud)
这是一些带有所有头信息的垃圾的另一个输出:
HTTP/1.1 200 OK
Date: Tue, 12 Apr 2011 23:23:11 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=8254688ee345202bd177d57e4ba339b2; path=/
Set-Cookie: PHPSESSID=73eae89f61e7268f433af9bdfe299173; path=/
Set-Cookie: PHPSESSID=8fb5d6fd9f1023bb00290b4daa3c7952; path=/
Connection: close
Transfer-Encoding: chunked
Content-Type: text; charset=us-ascii
e
Server Count:1
21
129.21.138.1,40000,Depth of …
Run Code Online (Sandbox Code Playgroud)