33 lines
945 B
C#
33 lines
945 B
C#
using System;
|
|
using System.Net.Sockets;
|
|
using System.Net;
|
|
using System.Threading;
|
|
using System.Text;
|
|
|
|
namespace MarcoPoloClient
|
|
{
|
|
class MainClass
|
|
{
|
|
const int MARCO_POLO_PORT = 22000;
|
|
const string MARCO_POLO_SERVER = "127.0.0.1";
|
|
|
|
public static void Main (string[] args)
|
|
{
|
|
while (true)
|
|
{
|
|
SocketClient client = new SocketClient();
|
|
|
|
string result = client.Connect(MARCO_POLO_SERVER, MARCO_POLO_PORT);
|
|
result = client.Send("polo doreen 25 75\n");
|
|
Console.WriteLine(String.Format("'polo' got back: '{0}'", result));
|
|
string response = client.Receive();
|
|
Console.WriteLine(String.Format("'polo' response: '{0}'", response));
|
|
client.Close();
|
|
|
|
Console.WriteLine("sleeping for half a second...");
|
|
Thread.Sleep(500);
|
|
}
|
|
}
|
|
}
|
|
}
|