From d8811b6b936368b50e331c8a43b4228483a5ebb0 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sun, 13 Nov 2022 14:45:45 +0100 Subject: [PATCH] Use a different port for the client and the server --- client/src/wivrn_client.cpp | 8 ++++---- common/wivrn_packets.h | 3 ++- server/driver/wivrn_connection.cpp | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/src/wivrn_client.cpp b/client/src/wivrn_client.cpp index 82afcbd9..0a067bb4 100644 --- a/client/src/wivrn_client.cpp +++ b/client/src/wivrn_client.cpp @@ -39,8 +39,8 @@ using namespace std::chrono_literals; wivrn_session::wivrn_session(in6_addr address, int port) : control(address, port), stream() { // TODO: negociate UDP port - stream.bind(stream_port); - stream.connect(address, stream_port); + stream.bind(stream_client_port); + stream.connect(address, stream_server_port); stream.set_receive_buffer_size(1024 * 1024 * 5); char buffer[100]; @@ -50,8 +50,8 @@ wivrn_session::wivrn_session(in6_addr address, int port) : control(address, port wivrn_session::wivrn_session(in_addr address, int port) : control(address, port), stream() { // TODO: negociate UDP port - stream.bind(stream_port); - stream.connect(address, stream_port); + stream.bind(stream_client_port); + stream.connect(address, stream_server_port); stream.set_receive_buffer_size(1024 * 1024 * 5); char buffer[100]; diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index cfd019cc..69efbb15 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -33,7 +33,8 @@ namespace xrt::drivers::wivrn { static const int control_port = 9757; -static const int stream_port = 9757; +static const int stream_client_port = 9757; +static const int stream_server_port = 9758; enum class device_id : uint8_t { diff --git a/server/driver/wivrn_connection.cpp b/server/driver/wivrn_connection.cpp index 1ff1c0ee..b5f07524 100644 --- a/server/driver/wivrn_connection.cpp +++ b/server/driver/wivrn_connection.cpp @@ -25,8 +25,8 @@ using namespace std::chrono_literals; wivrn_connection::wivrn_connection(TCP && tcp, in6_addr address) : control(std::move(tcp)) { - stream.bind(stream_port); - stream.connect(address, stream_port); + stream.bind(stream_server_port); + stream.connect(address, stream_client_port); } void wivrn_connection::send_control(const to_headset::control_packets & packet)