Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WncControllerK64F
Dependents: WNCProximityMqtt Pubnub_ATT_IoT_SK_WNC_sync BluemixDemo BluemixQS ... more
See the WNCInterface README in the Wiki tab for detailed information on this library.
Socket/Socket.h@25:52bad4105cac, 2017-03-09 (annotated)
- Committer:
- JMF
- Date:
- Thu Mar 09 01:00:12 2017 +0000
- Revision:
- 25:52bad4105cac
- Parent:
- 1:e511ea8d39d5
Fixed several syntax errors that were uncovered when mbed introduced a new compiler.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JMF | 1:e511ea8d39d5 | 1 | /* ===================================================================== |
| JMF | 1:e511ea8d39d5 | 2 | Copyright © 2016, Avnet (R) |
| JMF | 1:e511ea8d39d5 | 3 | |
| JMF | 1:e511ea8d39d5 | 4 | Contributors: |
| JMF | 1:e511ea8d39d5 | 5 | * James M Flynn, www.em.avnet.com |
| JMF | 1:e511ea8d39d5 | 6 | |
| JMF | 1:e511ea8d39d5 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| JMF | 1:e511ea8d39d5 | 8 | you may not use this file except in compliance with the License. |
| JMF | 1:e511ea8d39d5 | 9 | You may obtain a copy of the License at |
| JMF | 1:e511ea8d39d5 | 10 | |
| JMF | 1:e511ea8d39d5 | 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| JMF | 1:e511ea8d39d5 | 12 | |
| JMF | 1:e511ea8d39d5 | 13 | Unless required by applicable law or agreed to in writing, |
| JMF | 1:e511ea8d39d5 | 14 | software distributed under the License is distributed on an |
| JMF | 1:e511ea8d39d5 | 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
| JMF | 1:e511ea8d39d5 | 16 | either express or implied. See the License for the specific |
| JMF | 1:e511ea8d39d5 | 17 | language governing permissions and limitations under the License. |
| JMF | 1:e511ea8d39d5 | 18 | |
| JMF | 1:e511ea8d39d5 | 19 | @file WNCInterface.cpp |
| JMF | 1:e511ea8d39d5 | 20 | @version 1.0 |
| JMF | 1:e511ea8d39d5 | 21 | @date Sept 2016 |
| JMF | 1:e511ea8d39d5 | 22 | |
| JMF | 1:e511ea8d39d5 | 23 | ======================================================================== */ |
| JMF | 1:e511ea8d39d5 | 24 | |
| JMF | 1:e511ea8d39d5 | 25 | |
| JMF | 1:e511ea8d39d5 | 26 | #include <stddef.h> |
| JMF | 1:e511ea8d39d5 | 27 | #include "WNCInterface.h" |
| JMF | 1:e511ea8d39d5 | 28 | |
| JMF | 1:e511ea8d39d5 | 29 | #ifndef SOCKET_H_ |
| JMF | 1:e511ea8d39d5 | 30 | #define SOCKET_H_ |
| JMF | 1:e511ea8d39d5 | 31 | |
| JMF | 1:e511ea8d39d5 | 32 | #define SOCK_STREAM 1 //A TCP Socket type |
| JMF | 1:e511ea8d39d5 | 33 | #define SOCK_DGRAM 2 //a UDP Socket type |
| JMF | 1:e511ea8d39d5 | 34 | |
| JMF | 1:e511ea8d39d5 | 35 | /** Socket file descriptor and select wrapper */ |
| JMF | 1:e511ea8d39d5 | 36 | class Socket { |
| JMF | 1:e511ea8d39d5 | 37 | |
| JMF | 1:e511ea8d39d5 | 38 | public: |
| JMF | 1:e511ea8d39d5 | 39 | Socket(); |
| JMF | 1:e511ea8d39d5 | 40 | ~Socket(); |
| JMF | 1:e511ea8d39d5 | 41 | |
| JMF | 1:e511ea8d39d5 | 42 | int init(int timeout=1500); |
| JMF | 1:e511ea8d39d5 | 43 | |
| JMF | 1:e511ea8d39d5 | 44 | int connect(char *url, int type, int port); |
| JMF | 1:e511ea8d39d5 | 45 | int disconnect(); |
| JMF | 1:e511ea8d39d5 | 46 | void set_blocking(bool blocking, unsigned int timeout); //not used |
| JMF | 1:e511ea8d39d5 | 47 | |
| JMF | 1:e511ea8d39d5 | 48 | private: |
| JMF | 1:e511ea8d39d5 | 49 | int _sock_type; //contains the type of socket this is |
| JMF | 1:e511ea8d39d5 | 50 | unsigned int _timeout; //default timeout for all socket transactions |
| JMF | 1:e511ea8d39d5 | 51 | }; |
| JMF | 1:e511ea8d39d5 | 52 | |
| JMF | 1:e511ea8d39d5 | 53 | |
| JMF | 1:e511ea8d39d5 | 54 | #endif /* SOCKET_H_ */ |

