Add BeacomMessage property to pixelhub server for debugging purposes & send debugging message

This commit is contained in:
Starbeamrainbowlabs 2016-11-20 21:51:31 +00:00
parent 98daa35b46
commit e961c558ac
3 changed files with 12 additions and 4 deletions

View file

@ -87,6 +87,12 @@ namespace PixelHub.Net
}
}
public string BeaconMessage {
get {
return $"{Role}@{LocalIP}:{Port}";
}
}
/// <summary>
/// Initializes a new instance of the <see cref="PixelHub.Net.DiscoveryBeacon"/> class.
/// </summary>
@ -172,7 +178,7 @@ namespace PixelHub.Net
/// </summary>
private async Task emitOnce()
{
await Send($"{Role}@{LocalIP}:{Port}");
await Send(BeaconMessage);
}
/// <summary>

View file

@ -17,7 +17,7 @@ namespace PixelHub.Server
StreamWriter outgoing;
/// <summary>
/// Initializes a new <see cref="PixelHub.Server.PixelBot"/> instance and connects it to a Hull Pixelbot.
/// Initializes a new <see cref="PixelBot"/> instance and connects it to a Hull Pixelbot.
/// </summary>
/// <param name="inClient">The Tcp connection between the PixelHub server and the Hull PixelBot.</param>
public PixelBot(TcpClient inClient)
@ -28,7 +28,6 @@ namespace PixelHub.Server
/// <summary>
/// Starts listening for and handling messages that come from the remote PixelBot.
/// </summary>
/// <param name="client">Client.</param>
public async Task Handle()
{
if (Connected)
@ -39,12 +38,15 @@ namespace PixelHub.Server
incoming = new StreamReader(client.GetStream());
outgoing = new StreamWriter(client.GetStream()) { AutoFlush = true };
outgoing.WriteLine("Test message!");
string nextLine;
while((nextLine = await incoming.ReadLineAsync()) != null)
{
Console.WriteLine("Got message from client: '{0}'", nextLine.Trim());
}
Connected = false;
}

View file

@ -23,7 +23,7 @@ namespace PixelHub.Server
IPAddress.Parse("239.62.148.30"), port,
beaconWriter
);
beacon.LocalIP = IPAddress.Parse("10.42.0.1");
beacon.LocalIP = IPAddress.Parse("192.168.0.5");
beacon.NetworkInterfaceName = "wlan0";
PixelHub server = new PixelHub(port, serverWriter);