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

{

转载于:https://www.cnblogs.com/guligei/p/3565116.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值