NetworkSocketAPI
Dependents: HelloWizFi250Interface
Fork of NetworkSocketAPI by
Diff: NetworkInterface.h
- Revision:
- 80:9c6673c93082
- Parent:
- 79:43a7e8c0d6cc
- Child:
- 81:1600369a29dd
--- a/NetworkInterface.h Tue Apr 05 10:40:34 2016 -0500 +++ b/NetworkInterface.h Tue Apr 05 12:02:56 2016 -0500 @@ -18,6 +18,7 @@ #define NETWORK_INTERFACE_H #include "FunctionPointer.h" +#include "SocketAddress.h" /** * @enum ns_error_t @@ -71,10 +72,10 @@ /** Looks up the specified host's IP address /param name Hostname to lookup - /param port Optional port to pass to SocketAddress - /return Resolved IP address, SocketAddress with null IP address on failure + /param dest Destination for IP address, must have space for SocketAddress::IP_SIZE + /return 0 on success, negative on failure */ - virtual SocketAddress gethostbyname(const char *name, uint16_t port=0); + virtual int gethostbyname(const char *name, char *dest); protected: friend class Socket; @@ -132,7 +133,7 @@ one time [Default: 1] \return 0 on success, negative on failure */ - virtual int socket_listen(void *handle, int backlog=1) = 0; + virtual int socket_listen(void *handle, int backlog) = 0; /** Accept a new connection. \param handle Socket handle @@ -146,13 +147,13 @@ \param address SocketAddress to connect to \return 0 on success, negative on failure */ - virtual int socket_connect(void *handle, SocketAddress address) = 0; + virtual int socket_connect(void *handle, const SocketAddress &address) = 0; /** Check if the socket is connected \param handle Socket handle \return true if connected, false otherwise */ - virtual bool socket_is_connected(void *handle); + virtual bool socket_is_connected(void *handle) = 0; /** Send data to the remote host \param handle Socket handle @@ -177,7 +178,7 @@ \param size The length of the packet to be sent \return the number of written bytes on success, negative on failure */ - virtual int socket_sendto(void *handle, SocketAddress address, const void *data, unsigned size) = 0; + virtual int socket_sendto(void *handle, const SocketAddress &address, const void *data, unsigned size) = 0; /** Receive a packet from a remote endpoint \param handle Socket handle