diff --git a/src/mconnect/core.vala b/src/mconnect/core.vala index 5823d03..79bf760 100644 --- a/src/mconnect/core.vala +++ b/src/mconnect/core.vala @@ -31,9 +31,7 @@ class Core : Object { public static string device_id { owned get { - string host_name = Environment.get_host_name(); - string user = Environment.get_user_name(); - return @"$user@host_name"; + return Environment.get_host_name(); } private set {} @@ -41,7 +39,9 @@ class Core : Object { public static string device_name { owned get { - return Environment.get_host_name(); + string host_name = Environment.get_host_name(); + string user = Environment.get_user_name(); + return @"$user@$host_name"; } private set {} } diff --git a/src/mconnect/discovery.vala b/src/mconnect/discovery.vala index 4e88a69..5047bfa 100644 --- a/src/mconnect/discovery.vala +++ b/src/mconnect/discovery.vala @@ -101,6 +101,7 @@ class Discovery : GLib.Object var sock = new Socket(SocketFamily.IPV4, SocketType.DATAGRAM, SocketProtocol.UDP); + sock.broadcast = true; try { var sa = new InetSocketAddress(new InetAddress.from_string("255.255.255.255"), 1716); @@ -112,6 +113,7 @@ class Discovery : GLib.Object core.handlers.interfaces, core.handlers.interfaces); + debug("identity: %s", identity.to_string()); sock.send_to(sa, identity.to_string().data); } catch (Error e) { warning("failed to send annoucement: %s", e.message); diff --git a/src/mconnect/packet.vala b/src/mconnect/packet.vala index 082b301..486352e 100644 --- a/src/mconnect/packet.vala +++ b/src/mconnect/packet.vala @@ -132,7 +132,8 @@ class Packet : GLib.Object { string device_id, string[] in_interfaces, string[] out_interfaces, - string device_type = "desktop") { + string device_type = "desktop", + uint tcp_port = 1716) { var builder = new Json.Builder(); builder.begin_object(); builder.set_member_name("deviceName"); @@ -147,6 +148,8 @@ class Packet : GLib.Object { builder.add_string_value(string.joinv(",", out_interfaces)); builder.set_member_name("protocolVersion"); builder.add_int_value(PROTOCOL_VERSION); + builder.set_member_name("tcpPort"); + builder.add_int_value(tcp_port); builder.end_object(); Json.Object data_obj = builder.get_root().get_object();