blob: 59fd570b49813204ee99ddeb580932e3229fc8b7 [file] [log] [blame]
#include "aos/common/network/SendSocket.h"
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <stddef.h>
#include <math.h>
#include "aos/common/network/SocketLibraries.h"
#include "aos/common/logging/logging.h"
namespace aos {
int SendSocket::Connect(NetworkPort port, const char *robot_ip, int type) {
Reset();
const int ret = Socket::Connect(port, robot_ip, type);
if (ret != 0) {
return ret;
}
if (connect(socket_, &addr_.addr,
sizeof(addr_)) < 0) {
LOG(ERROR, "couldn't connect to ip '%s' because of %d: %s\n", robot_ip,
errno, strerror(errno));
last_ret_ = 1;
}
return last_ret_ = 0;
}
} // namespace aos