socket didReadData
原来是 这样的,socket 里面读取数据,可 怎么 以手机作为 局域网服务器,给 Android 客户端 写上几个 类似服务器的 接口呢,接口名字怎么 写呢?
#pragma mark AsyncSocket Delegate
/////////////////////////////////////////////////////////
header field,有点协议约定的 感觉了,
{
"Accept-Encoding" = gzip;
Connection = "keep-alive";
"Content-Length" = 54;
"Content-Type" = "application/x-www-form-urlencoded; charset=utf-8";
Host = "192.168.0.9:12345";
"User-Agent" = "iPhoneHTTPServer 1.0 (iPhone; iPhone OS 6.1.3; zh_CN)";
}
///////////////////////////////////////////////////////////////
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-------+-+-------------+-------------------------------+
// |F|R|R|R| opcode|M| Payload len | Extended payload length |
// |I|S|S|S| (4) |A| (7) | (16/64) |
// |N|V|V|V| |S| | (if payload len==126/127) |
// | |1|2|3| |K| | |
// +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
// | Extended payload length continued, if payload len == 127 |
// + - - - - - - - - - - - - - - - +-------------------------------+
// | |Masking-key, if MASK set to 1 |
// +-------------------------------+-------------------------------+
// | Masking-key (continued) | Payload Data |
// +-------------------------------- - - - - - - - - - - - - - - - +
// : Payload Data continued ... :
// + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
// | Payload Data continued ... |
// +---------------------------------------------------------------+
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag
{