diff --git a/src/device/peripheral/mros-dev/mros-athrill/target/lwip/lwip_linux.c b/src/device/peripheral/mros-dev/mros-athrill/target/lwip/lwip_linux.c index ee0fdeb5..7cf4490a 100644 --- a/src/device/peripheral/mros-dev/mros-athrill/target/lwip/lwip_linux.c +++ b/src/device/peripheral/mros-dev/mros-athrill/target/lwip/lwip_linux.c @@ -45,8 +45,7 @@ int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *opt int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen) { - //TODO - return 0; + return setsockopt(s, level, optname, optval, optlen); } int lwip_close(int s) diff --git a/src/device/peripheral/mros-dev/mros-src/comm/cimpl/mros_comm_tcp_server_cimpl.c b/src/device/peripheral/mros-dev/mros-src/comm/cimpl/mros_comm_tcp_server_cimpl.c index 4d019d5b..a23ea443 100644 --- a/src/device/peripheral/mros-dev/mros-src/comm/cimpl/mros_comm_tcp_server_cimpl.c +++ b/src/device/peripheral/mros-dev/mros-src/comm/cimpl/mros_comm_tcp_server_cimpl.c @@ -28,6 +28,14 @@ mRosReturnType mros_comm_tcp_server_bind(mRosCommTcpServerType *server, mros_int mRosSockAddrInType addr; mros_comm_inet_local_sockaddr_init(&addr, port); + + int yes = 1; + ret = mros_comm_setsockopt(server->socket.sock_fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&yes, sizeof(yes)); + if (ret != MROS_E_OK) { + ROS_ERROR("%s %s() %u ret=%d", __FILE__, __FUNCTION__, __LINE__, ret); + return MROS_E_SYSERR; + } + ret = mros_comm_bind(server->socket.sock_fd, (mRosSockAddrType*)&addr, sizeof(mRosSockAddrInType)); if (ret != MROS_E_OK) { ROS_ERROR("%s %s() %u ret=%d", __FILE__, __FUNCTION__, __LINE__, ret);