|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|