NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
UDPSocket.cpp
- Committer:
- Christopher Haster
- Date:
- 2016-02-18
- Branch:
- api-changes
- Revision:
- 24:a5e959bdd2dd
- Parent:
- 22:4fca633c0633
- Child:
- 25:ed7b2a52e8ac
File content as of revision 24:a5e959bdd2dd:
/* UDPSocket * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "UDPSocket.h" UDPSocket::UDPSocket(NetworkInterface *iface, const char *url, uint16_t port) : _iface(iface) { _socket = _iface->createSocket(SOCK_UDP); if (url) setURL(url); if (port) setPort(port); } UDPSocket::~UDPSocket() { _iface->destroySocket(_socket); } void UDPSocket::setURL(const char *url) { return _socket->setURL(url); } void UDPSocket::setIPAddress(const char *ip) { return _socket->setIPAddress(ip); } void UDPSocket::setPort(uint16_t port) { return _socket->setPort(port); } const char *UDPSocket::getIPAddress() { return _socket->getIPAddress(); } uint16_t UDPSocket::getPort() { return _socket->getPort(); } int32_t UDPSocket::send(const void *data, uint32_t len, uint32_t timeout_ms) { return _socket->send(data, len, timeout_ms); } int32_t UDPSocket::recv(void *data, uint32_t len, uint32_t timeout_ms) { return _socket->recv(data, len, timeout_ms); }