|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using Utils;
namespace ConsoleReciver
{
class Program
{
static void Main(string[] args)
{
SocketReciever<SocketData,ResponseData> socketReciver = new SocketReciever<SocketData,ResponseData>("localhost", 8000);
socketReciver.OnConnectionChanged += new SocketReciever<SocketData,ResponseData>.ConnectionChanged(socketReciver_OnConnectionChanged);
socketReciver.OnNewData += new SocketReciever<SocketData,ResponseData>.NewData(socketReciver_OnNewData);
socketReciver.Start(5000);
String readLine = Console.ReadLine();
while (readLine != "exit")
{
socketReciver.SendResponse(new ResponseData(readLine, DateTime.Now));
readLine = Console.ReadLine();
}
socketReciver.Stop();
}
static void socketReciver_OnNewData(SocketData data)
{
Console.WriteLine("Data: " + data.Number.ToString() + " : " + data.Time.ToString());
}
static void socketReciver_OnConnectionChanged(bool connected)
{
Console.WriteLine("Connection: " + connected.ToString());
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.