mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-12 11:00:47 +02:00
Added set options function for sockets
This commit is contained in:
@@ -16,6 +16,12 @@ TCPSocket::~TCPSocket()
|
||||
close();
|
||||
}
|
||||
|
||||
void TCPSocket::setOptions(int socket_fd)
|
||||
{
|
||||
int flag = 1;
|
||||
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
|
||||
}
|
||||
|
||||
bool TCPSocket::setup(std::string &host, int port)
|
||||
{
|
||||
if(state_ == SocketState::Connected)
|
||||
@@ -63,6 +69,7 @@ bool TCPSocket::setup(std::string &host, int port)
|
||||
}
|
||||
else
|
||||
{
|
||||
setOptions(socket_fd_);
|
||||
state_ = SocketState::Connected;
|
||||
LOG_INFO("Connection established for %s:%d", host.c_str(), port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user