ThingPlug GMMP library for mbed
Dependents: ThingPlug_WiFi_Example
Network/Network.h@0:32c20cfb2b30, 2015-07-23 (annotated)
- Committer:
- lesmin
- Date:
- Thu Jul 23 00:55:15 2015 +0000
- Revision:
- 0:32c20cfb2b30
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lesmin | 0:32c20cfb2b30 | 1 | /** TCP Socket 통신을 위한 모듈 |
lesmin | 0:32c20cfb2b30 | 2 | * @file Network.h |
lesmin | 0:32c20cfb2b30 | 3 | * @date 2015/07/20 |
lesmin | 0:32c20cfb2b30 | 4 | * @version 0.0.1.0 |
lesmin | 0:32c20cfb2b30 | 5 | **/ |
lesmin | 0:32c20cfb2b30 | 6 | |
lesmin | 0:32c20cfb2b30 | 7 | #ifndef NETWORK_H_ |
lesmin | 0:32c20cfb2b30 | 8 | #define NETWORK_H_ |
lesmin | 0:32c20cfb2b30 | 9 | |
lesmin | 0:32c20cfb2b30 | 10 | #include "Define.h" |
lesmin | 0:32c20cfb2b30 | 11 | #include "GMMP_Util.h" |
lesmin | 0:32c20cfb2b30 | 12 | |
lesmin | 0:32c20cfb2b30 | 13 | /** |
lesmin | 0:32c20cfb2b30 | 14 | *@brief 서버와 연결된 TCP Socket을 닫는다. |
lesmin | 0:32c20cfb2b30 | 15 | */ |
lesmin | 0:32c20cfb2b30 | 16 | void CloseSocket(); |
lesmin | 0:32c20cfb2b30 | 17 | |
lesmin | 0:32c20cfb2b30 | 18 | /** |
lesmin | 0:32c20cfb2b30 | 19 | * @brief TCP Socket을 연결한다. |
lesmin | 0:32c20cfb2b30 | 20 | * @return 성공 : GMMMP_SUCCESS, 실패 : @ref ErrorCode.h 참조 |
lesmin | 0:32c20cfb2b30 | 21 | */ |
lesmin | 0:32c20cfb2b30 | 22 | int Connect(); |
lesmin | 0:32c20cfb2b30 | 23 | |
lesmin | 0:32c20cfb2b30 | 24 | /** |
lesmin | 0:32c20cfb2b30 | 25 | * @brief TCP Socket에 Write한다. |
lesmin | 0:32c20cfb2b30 | 26 | * @param pBuf Write 버퍼 포인트. |
lesmin | 0:32c20cfb2b30 | 27 | * @param nLen Write 버퍼 크기. |
lesmin | 0:32c20cfb2b30 | 28 | * @return 성공 : GMMMP_SUCCESS, 실패 : @ref ErrorCode.h 참조 |
lesmin | 0:32c20cfb2b30 | 29 | */ |
lesmin | 0:32c20cfb2b30 | 30 | int WriteTCP(char* pBuf, int nLen); |
lesmin | 0:32c20cfb2b30 | 31 | |
lesmin | 0:32c20cfb2b30 | 32 | /** |
lesmin | 0:32c20cfb2b30 | 33 | * @brief TCP Socket을 Read한다. |
lesmin | 0:32c20cfb2b30 | 34 | * @param _pBuf Read 버퍼 포인트. |
lesmin | 0:32c20cfb2b30 | 35 | * @param _nMaxlen Read 버퍼 최대 크기 |
lesmin | 0:32c20cfb2b30 | 36 | * @return 성공 : GMMMP_SUCCESS, 실패 : @ref ErrorCode.h 참조 |
lesmin | 0:32c20cfb2b30 | 37 | */ |
lesmin | 0:32c20cfb2b30 | 38 | int ReadTCP(char* _pBuf, const int _nMaxlen); |
lesmin | 0:32c20cfb2b30 | 39 | |
lesmin | 0:32c20cfb2b30 | 40 | /** |
lesmin | 0:32c20cfb2b30 | 41 | * @brief TCP Socket을 Read한다. (Blocking/Non-blocking 지원) |
lesmin | 0:32c20cfb2b30 | 42 | * @param _pBuf Read 버퍼 포인트. |
lesmin | 0:32c20cfb2b30 | 43 | * @param _nMaxlen Read 버퍼 최대 크기 |
lesmin | 0:32c20cfb2b30 | 44 | * @param blocking blocking: 1, non-blocking: 0 |
lesmin | 0:32c20cfb2b30 | 45 | * @return 성공 : GMMMP_SUCCESS, 실패 : @ref ErrorCode.h 참조 |
lesmin | 0:32c20cfb2b30 | 46 | */ |
lesmin | 0:32c20cfb2b30 | 47 | int ReadTCP2(char* _pBuf, const int _nMaxlen, byte blocking); |
lesmin | 0:32c20cfb2b30 | 48 | |
lesmin | 0:32c20cfb2b30 | 49 | /** |
lesmin | 0:32c20cfb2b30 | 50 | * @brief TCP Socket 세션 유지를 확인한다. 세션이 연결이 되어 있지 않다면 연결을 시도한다. |
lesmin | 0:32c20cfb2b30 | 51 | * @return 성공 : GMMMP_SUCCESS, 실패 : @ref ErrorCode.h 참조 |
lesmin | 0:32c20cfb2b30 | 52 | */ |
lesmin | 0:32c20cfb2b30 | 53 | int CheckSocket(); |
lesmin | 0:32c20cfb2b30 | 54 | #endif /* NETWORK_H_ */ |