looping it up and cleaning up whitespace, too
This commit is contained in:
parent
665d867bc4
commit
46def9b2f6
@ -12,14 +12,21 @@ namespace MarcoPoloClient
|
|||||||
const string MARCO_POLO_SERVER = "127.0.0.1";
|
const string MARCO_POLO_SERVER = "127.0.0.1";
|
||||||
|
|
||||||
public static void Main (string[] args)
|
public static void Main (string[] args)
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
SocketClient client = new SocketClient();
|
SocketClient client = new SocketClient();
|
||||||
|
|
||||||
string result = client.Connect(MARCO_POLO_SERVER, MARCO_POLO_PORT);
|
string result = client.Connect(MARCO_POLO_SERVER, MARCO_POLO_PORT);
|
||||||
result = client.Send("polo doreen 25 75\n");
|
result = client.Send("polo doreen 25 75\n");
|
||||||
Console.WriteLine(String.Format("'polo' got back: '{0}'", result));
|
Console.WriteLine(String.Format("'polo' got back: '{0}'", result));
|
||||||
string response = client.Receive();
|
string response = client.Receive();
|
||||||
Console.WriteLine(String.Format("'polo' response: '{0}'", response));
|
Console.WriteLine(String.Format("'polo' response: '{0}'", response));
|
||||||
client.Close();
|
client.Close();
|
||||||
|
|
||||||
|
Console.WriteLine("sleeping for half a second...");
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ namespace MarcoPoloClient
|
|||||||
{
|
{
|
||||||
result = e.SocketError.ToString ();
|
result = e.SocketError.ToString ();
|
||||||
_clientDone.Set ();
|
_clientDone.Set ();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
_clientDone.Reset ();
|
_clientDone.Reset ();
|
||||||
_socket.ConnectAsync (socketEventArg);
|
_socket.ConnectAsync (socketEventArg);
|
||||||
@ -55,7 +56,8 @@ namespace MarcoPoloClient
|
|||||||
{
|
{
|
||||||
response = e.SocketError.ToString ();
|
response = e.SocketError.ToString ();
|
||||||
_clientDone.Set ();
|
_clientDone.Set ();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
byte[] payload = Encoding.UTF8.GetBytes (data);
|
byte[] payload = Encoding.UTF8.GetBytes (data);
|
||||||
socketEventArg.SetBuffer (payload, 0, payload.Length);
|
socketEventArg.SetBuffer (payload, 0, payload.Length);
|
||||||
@ -87,7 +89,8 @@ namespace MarcoPoloClient
|
|||||||
response = e.SocketError.ToString ();
|
response = e.SocketError.ToString ();
|
||||||
}
|
}
|
||||||
_clientDone.Set ();
|
_clientDone.Set ();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
_clientDone.Reset ();
|
_clientDone.Reset ();
|
||||||
_socket.ReceiveAsync (socketEventArg);
|
_socket.ReceiveAsync (socketEventArg);
|
||||||
|
Loading…
Reference in New Issue
Block a user