我阅读了有关在 Windows 手机上使用套接字的 msdn 教程。(http://msdn.microsoft.com/en-us/library/system.net.sockets.socket(v=VS.96).aspx)我来连接服务器。
这个,给我回复 200(OK 回复)=>
HTTP/1.1 200 OK
Date: Mon, 16 Apr 2012 12:45:46 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny13 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
Last-Modified: Tue, 08 Aug 2006 14:12:09 GMT
ETag: "129a2e5-100000-41a822e23a040"
Accept-Ranges: byte
但是我不知道下一步该怎么做...
我将我连接到服务器,我发送了一个“GET Message”以下载文件
"GET /dwn/file.txt HTTP/1.1\r\nHost:myHost.com\r\n\r\n"
和回应之后?我必须做什么?
如果您知道教程、示例或只是解释,我将非常感谢您!
这是我的功能 =>
private void ProcessReceive(SocketAsyncEventArgs e)
{
if (e.SocketError == SocketError.Success)
{
response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
response = response.Trim('\0');
// show the response server value.
Debug.WriteLine(response.ToString());
// Data has now been sent and received from the server.
// Disconnect from the server
socket = e.UserToken as Socket;
socket.Shutdown(SocketShutdown.Send);
socket.Close();
clientDone.Set();
}
else
{
// show error in the debugger.
response = e.SocketError.ToString();
Debug.WriteLine(response);
}
}