I found this code in older thread:
Code:
private static SimpleSilkroadClient client;
private static Thread thSessionUpdater;
static void Main(string[] args)
{
Console.Title = "SampleClient";
client = new SimpleSilkroadClient();
client.OnCommandReceived += Client_OnCommandReceived;
client.Connect("127.0.0.1", 39000);
thSessionUpdater = new Thread(ThreadedSessionUpdating);
thSessionUpdater.Start();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
private static void ThreadedSessionUpdating()
{
while (true)
{
if (client != null)
client.Update();
System.Threading.Thread.Sleep(1);
}
}
private static void Client_OnCommandReceived(Packet packet)
{
//PACKET HANDLING
if (packet.Opcode == 0x1234) //SAMPLE OPCODE
{
string message = packet.ReadAscii();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Message: {0}", message);
Console.ResetColor();
Packet sampleResponse = new Packet(0x1234);
sampleResponse.WriteAscii("Hello. It's nice being connected to you :)");
client.Send(sampleResponse);
}
}
if i put the gameserver ip and port this will connect to it?