| | |
| | | #ifndef TCPDATATYPE_H |
| | | #define TCPDATATYPE_H |
| | | /*请求类型*/ |
| | | /* */ |
| | | enum class ActionType |
| | | { |
| | | HeartCheck = 100, |
| | |
| | | Msg = 200, |
| | | Download = 300 |
| | | }; |
| | | /*参考HTTP的响应码*/ |
| | | /* ο HTTP Ӧ */ |
| | | enum class ResponseCode |
| | | { |
| | | ResponseOK = 200, // 请求成功。 |
| | | BadRequest = 400, // 客户端请求的语法错误,服务器无法理解 |
| | | Unauthorized = 401, // 请求要求用户的身份认证 |
| | | Forbidden = 403, // 服务器理解请求客户端的请求,但是拒绝执行此请求 |
| | | NotFound = 404, // 服务器无法找到请求的资源 |
| | | MethodNotAllowed = 405 // 客户端请求中的方法被禁止 |
| | | ResponseOK = 200, // ɹ |
| | | BadRequest = 400, // ͻ |
| | | Unauthorized = 401, // Ҫ û ֤ |
| | | Forbidden = 403, // ͻ ˵ Ǿܾ ִ д |
| | | NotFound = 404, // ҵ Դ |
| | | MethodNotAllowed = 405 // ͻ еķ ֹ |
| | | |
| | | }; |
| | | /*消息体*/ |
| | | /* Ϣ */ |
| | | struct Head |
| | | { |
| | | ActionType type; |
| | |
| | | version = pversion; |
| | | } |
| | | }; |
| | | struct HeartCheckReq // 心跳请求包 |
| | | struct HeartCheckReq // |
| | | { |
| | | ActionType type; |
| | | int len; |
| | |
| | | } |
| | | }; |
| | | |
| | | struct HeartCheckRes // 心跳响应包 |
| | | struct HeartCheckRes // Ӧ |
| | | { |
| | | ActionType type; |
| | | int len; |