21 if (
sock !=
nullptr) {
29 if (
sock ==
nullptr) {
32 return sock->send(buf, n);
41 if (
sock ==
nullptr) {
43 if (
sock !=
nullptr) {
47 if (
sock ==
nullptr) {
50 ssize_t ret =
sock->recv(buf, n, 1);
66 ::printf(
"bind failed on %s port %u - %s\n",
77 ::printf(
"listen failed on %s port %u - %s\n",
89 ::printf(
"Waiting for connection on %s:%u ....\n",
92 while (
sock ==
nullptr) {
105 if (
sock !=
nullptr) {
int printf(const char *fmt,...)
TCPServerDevice(const char *ip, uint16_t port, bool wait)
virtual ssize_t write(const uint8_t *buf, uint16_t n) override
virtual void set_blocking(bool blocking) override
char * strerror(int errnum)
POSIX strerror() - convert POSIX errno to text with user message.
virtual ~TCPServerDevice()
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
virtual void set_speed(uint32_t speed) override
virtual bool close() override
int errno
Note: fdevopen assigns stdin,stdout,stderr.
virtual bool open() override
uint32_t _last_bind_warning
virtual ssize_t read(uint8_t *buf, uint16_t n) override