Go to the documentation of this file.
55 ERROR(
"failed to initialize network client for device "
56 << dev <<
": result = " << (
int) result);
64 ERROR(
"failed to create UDP socket on device " << dev <<
65 ": result = " << (
int) result);
73 ERROR(
"failed to bind socket to UDP port " << port <<
74 " on device " << dev <<
": result = " << (
int) result);
107 for (
Size i = 0; i < count;)
115 ERROR(
"failed to send multiple UDP packets: result = " << (
int) r);
const char * get(const char *name) const
Get argument by name.
Result initialize()
Perform initialization.
Result createSocket(const SocketType type, int *socket)
Create new socket.
C int errno
The lvalue errno is used by many functions to return error values.
NetworkClient * m_client
Network client.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
static const Size MaxPackets
Maximum number of packets available.
NetSend(int argc, char **argv)
Class constructor.
POSIX-compatible application.
const ArgumentContainer & arguments() const
Get program arguments.
void setDescription(const String &desc)
Set program description.
Defines a socket address and port pair.
#define DEBUG(msg)
Output a debug message to standard output.
Describes one or more datagrams.
unsigned short u16
Unsigned 16-bit number.
static const Address toAddress(const char *address)
Convert string to IPV4 address.
char * strerror(int errnum)
The strerror function maps the number in errnum to a message string.
Result udpSendMultiple(const struct iovec *vec, const Size count, const struct sockaddr &addr) const
Send multiple UDP packets.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result initialize()
Initialize the application.
Networking Client implementation.
Input/Output vector for multi-packet operations.
Result bindSocket(const int sock, const IPV4::Address addr=0, const u16 port=0)
Bind socket to address/port.
Result registerPositional(const char *name, const char *description, Size count=1)
Register a positional argument.
static const String toString(const Address address)
Convert address to string.
ArgumentParser & parser()
Get program arguments parser.
#define ERROR(msg)
Output an error message.
unsigned char u8
Unsigned 8-bit number.
static const Size PacketSize
Size of each packet to send in bytes.
static const Size QueueSize
Number of packets to submit for transmission each iteration.
static const Size PayloadBufferSize
Size of payload memory buffer.
virtual Result exec()
Execute the application event loop.
virtual ~NetSend()
Class destructor.
C int sendmsg(int sockfd, const struct msghdr *msg, int flags)
Send multiple datagrams to a remote host.
long toLong(const Number::Base base=Number::Dec) const
Convert the String to a signed long integer.