WORKS

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers UDPSocket.h Source File

UDPSocket.h

00001 /*
00002  * PackageLicenseDeclared: Apache-2.0
00003  * Copyright (c) 2015 ARM Limited
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef __MBED_NET_SOCKETS_V0_UDPSOCKET_H__
00018 #define __MBED_NET_SOCKETS_V0_UDPSOCKET_H__
00019 
00020 #include <stddef.h>
00021 #include <stdint.h>
00022 #include "Socket.h"
00023 
00024 namespace mbed {
00025 namespace Sockets {
00026 namespace v0 {
00027 
00028 /* UDP socket class */
00029 class UDPSocket: public Socket {
00030 public:
00031     /**
00032      * UDP socket constructor.
00033      * Does not allocate an underlying UDP Socket instance.
00034      * @param[in] stack The network stack to use for this socket.
00035      */
00036     UDPSocket(socket_stack_t stack);
00037     /**
00038      * UDP Socket destructor
00039      */
00040     ~UDPSocket();
00041     /**
00042      * Open a UDP socket
00043      * Instantiates and initializes the underlying socket. Receive is started immediately after
00044      * the socket is opened.
00045      * @param[in] af Address family (SOCKET_AF_INET4 or SOCKET_AF_INET6), currently only IPv4 is supported
00046      * @return SOCKET_ERROR_NONE on success, or an error code on failure
00047      */
00048     socket_error_t inline open(const socket_address_family_t af)
00049     {
00050         return Socket::open(af,SOCKET_DGRAM);
00051     }
00052     /**
00053      * Connect to a remote host.
00054      * This is an internal configuration API only.  No network traffic is generated.
00055      * @param[in] address The remote host to connect to
00056      * @param[in] port The remote port to connect to
00057      * @return SOCKET_ERROR_NONE on success, or an error code on failure
00058      */
00059     socket_error_t connect(const SocketAddr *address, const uint16_t port);
00060 };
00061 } // namespace v0
00062 } // namespace Sockets
00063 } // namespace mbed
00064 #endif // __MBED_NET_SOCKETS_V0_UDPSOCKET_H__