34 lines
629 B
C#
34 lines
629 B
C#
|
using System;
|
|||
|
using System.Net.Sockets;
|
|||
|
using System.Net;
|
|||
|
using System.IO;
|
|||
|
namespace PixelHubClientTest
|
|||
|
{
|
|||
|
public class PixelHubClient
|
|||
|
{
|
|||
|
TcpClient client;
|
|||
|
|
|||
|
StreamReader incoming;
|
|||
|
StreamWriter outgoing;
|
|||
|
|
|||
|
public PixelHubClient ()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public void Connect (IPAddress destination, int port)
|
|||
|
{
|
|||
|
client = new TcpClient();
|
|||
|
client.Connect(destination, port);
|
|||
|
|
|||
|
incoming = new StreamReader(client.GetStream());
|
|||
|
outgoing = new StreamWriter(client.GetStream()) { AutoFlush = true };
|
|||
|
}
|
|||
|
|
|||
|
public void Test ()
|
|||
|
{
|
|||
|
outgoing.WriteLine("Testing!");
|
|||
|
Console.WriteLine("> {0}", incoming.ReadLine());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|