-
Notifications
You must be signed in to change notification settings - Fork 3
Client
George Michaelides edited this page Mar 8, 2015
·
24 revisions
###Connect to a server
var client = new GemClient( Profile: "GemChat"
ServerName: "GemServer" ,
IP: "127.0.0.1",
Port: 14242);
client.RunAsync(() => new ConnectionApprovalMessage
{
Message = "Incoming client",
Sender = "Example",
Password = "1234"
});
###Execute a console command
//The commands' output
GemNetworkDebugger.Echo = Console.WriteLine;
string command = "echo This is a test";
client.SendCommand(commmand);
###Network Outgoing Messages
INetworkEvent sayEvent;
void SetupNetworkEvent()
{
sayEvent = GemClient.Profile("GemChat")
.CreateNetworkEvent
.HandleWith(this, x => new Action<string,string>(x.Say));
}
public void Say(string name, string message)
{
Console.WriteLine(String.Format("{0} : {1}",name,message);
sayEvent.Send(name,message).
}
###Abstract Network Message Flow