RC
Dependents: WizFi250_AP_HelloWorld
Fork of WizFi250Interface by
Socket/Socket.h@10:187e3fd24123, 2015-06-22 (annotated)
- Committer:
- kaizen
- Date:
- Mon Jun 22 12:18:57 2015 +0000
- Revision:
- 10:187e3fd24123
- Parent:
- 9:12ecb377f63f
Fixed some compile error
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaizen | 0:f2039204c8f6 | 1 | /* Copyright (C) 2012 mbed.org, MIT License |
kaizen | 0:f2039204c8f6 | 2 | * |
kaizen | 0:f2039204c8f6 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
kaizen | 0:f2039204c8f6 | 4 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
kaizen | 0:f2039204c8f6 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
kaizen | 0:f2039204c8f6 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
kaizen | 0:f2039204c8f6 | 7 | * furnished to do so, subject to the following conditions: |
kaizen | 0:f2039204c8f6 | 8 | * |
kaizen | 0:f2039204c8f6 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
kaizen | 0:f2039204c8f6 | 10 | * substantial portions of the Software. |
kaizen | 0:f2039204c8f6 | 11 | * |
kaizen | 0:f2039204c8f6 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
kaizen | 0:f2039204c8f6 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
kaizen | 0:f2039204c8f6 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kaizen | 0:f2039204c8f6 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kaizen | 0:f2039204c8f6 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kaizen | 0:f2039204c8f6 | 17 | */ |
kaizen | 0:f2039204c8f6 | 18 | /* Copyright (C) 2014 Wiznet, MIT License |
kaizen | 0:f2039204c8f6 | 19 | * port to the Wiznet Module WizFi250 |
kaizen | 0:f2039204c8f6 | 20 | */ |
kaizen | 0:f2039204c8f6 | 21 | |
kaizen | 0:f2039204c8f6 | 22 | #ifndef SOCKET_H_ |
kaizen | 0:f2039204c8f6 | 23 | #define SOCKET_H_ |
kaizen | 0:f2039204c8f6 | 24 | |
kaizen | 0:f2039204c8f6 | 25 | #include "WizFi250.h" |
kaizen | 0:f2039204c8f6 | 26 | |
kaizen | 0:f2039204c8f6 | 27 | /** Socket file descriptor and select wrapper |
kaizen | 0:f2039204c8f6 | 28 | */ |
kaizen | 0:f2039204c8f6 | 29 | class Socket { |
kaizen | 0:f2039204c8f6 | 30 | public: |
kaizen | 0:f2039204c8f6 | 31 | /** Socket |
kaizen | 0:f2039204c8f6 | 32 | */ |
kaizen | 0:f2039204c8f6 | 33 | Socket(); |
kaizen | 0:f2039204c8f6 | 34 | |
kaizen | 0:f2039204c8f6 | 35 | /** Set blocking or non-blocking mode of the socket and a timeout on |
kaizen | 0:f2039204c8f6 | 36 | blocking socket operations |
kaizen | 0:f2039204c8f6 | 37 | \param blocking true for blocking mode, false for non-blocking mode. |
kaizen | 0:f2039204c8f6 | 38 | \param timeout timeout in ms [Default: (1500)ms]. |
kaizen | 0:f2039204c8f6 | 39 | */ |
kaizen | 0:f2039204c8f6 | 40 | void set_blocking(bool blocking, unsigned int timeout=1500); |
kaizen | 0:f2039204c8f6 | 41 | |
kaizen | 0:f2039204c8f6 | 42 | /** Close the socket file descriptor |
kaizen | 0:f2039204c8f6 | 43 | */ |
kaizen | 0:f2039204c8f6 | 44 | int close(); |
kaizen | 0:f2039204c8f6 | 45 | |
kaizen | 0:f2039204c8f6 | 46 | ~Socket(); |
kaizen | 0:f2039204c8f6 | 47 | |
kaizen | 0:f2039204c8f6 | 48 | protected: |
kaizen | 0:f2039204c8f6 | 49 | bool _blocking; |
kaizen | 0:f2039204c8f6 | 50 | int _timeout; |
kaizen | 10:187e3fd24123 | 51 | WizFi250 * _wizfi250; |
kaizen | 0:f2039204c8f6 | 52 | |
kaizen | 0:f2039204c8f6 | 53 | bool _server; |
kaizen | 0:f2039204c8f6 | 54 | int _cid; |
kaizen | 0:f2039204c8f6 | 55 | int _port; |
kaizen | 0:f2039204c8f6 | 56 | }; |
kaizen | 0:f2039204c8f6 | 57 | |
kaizen | 0:f2039204c8f6 | 58 | |
kaizen | 0:f2039204c8f6 | 59 | #endif /* SOCKET_H_ */ |