Compare commits
2 commits
7a3eaf2847
...
9569e2c59b
Author | SHA1 | Date | |
---|---|---|---|
9569e2c59b | |||
9e19127699 |
5 changed files with 116 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProjectGuid>{1D99DDDB-9457-4B8D-83B8-06663554F4C4}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>PixelHubClientTest</RootNamespace>
|
||||||
|
<AssemblyName>PixelHubClientTest</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="PixelHubClient.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
33
PixelHub-Client-Test/PixelHub-Client-Test/PixelHubClient.cs
Normal file
33
PixelHub-Client-Test/PixelHub-Client-Test/PixelHubClient.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
PixelHub-Client-Test/PixelHub-Client-Test/Program.cs
Normal file
15
PixelHub-Client-Test/PixelHub-Client-Test/Program.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace PixelHubClientTest
|
||||||
|
{
|
||||||
|
class MainClass
|
||||||
|
{
|
||||||
|
public static void Main (string[] args)
|
||||||
|
{
|
||||||
|
PixelHubClient pixelClient = new PixelHubClient();
|
||||||
|
pixelClient.Connect(IPAddress.Parse("10.42.0.1"), 5050);
|
||||||
|
pixelClient.Test();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following attributes.
|
||||||
|
// Change them to the values specific to your project.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("PixelHubClientTest")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("")]
|
||||||
|
[assembly: AssemblyCopyright("Starbeamrainbowlabs")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||||
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
||||||
|
//[assembly: AssemblyDelaySign(false)]
|
||||||
|
//[assembly: AssemblyKeyFile("")]
|
|
@ -99,11 +99,13 @@ namespace PixelHub.Server
|
||||||
public async Task Listen()
|
public async Task Listen()
|
||||||
{
|
{
|
||||||
server = new TcpListener(Endpoint);
|
server = new TcpListener(Endpoint);
|
||||||
|
server.Start();
|
||||||
logger.WriteLine("TCP Listener set up on {0}.", Endpoint);
|
logger.WriteLine("TCP Listener set up on {0}.", Endpoint);
|
||||||
Active = true;
|
Active = true;
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
TcpClient nextClient = await server.AcceptTcpClientAsync();
|
TcpClient nextClient = await server.AcceptTcpClientAsync();
|
||||||
|
Console.WriteLine("Got connection");
|
||||||
AsyncTools.ForgetTask(Handle(nextClient));
|
AsyncTools.ForgetTask(Handle(nextClient));
|
||||||
}
|
}
|
||||||
// TODO: Add an shutdown CancellationToken thingy here
|
// TODO: Add an shutdown CancellationToken thingy here
|
||||||
|
|
Reference in a new issue