Example #1
0
        static void Main(string[] args)
        {
            socket.Connect("127.0.0.1", 9000);

            Console.WriteLine("/q - exit");
            Console.WriteLine("Please enter a command");

            string command = "";

            while (true)
            {
                command = Console.ReadLine();
                if (command.ToLower() == "/q")
                {
                    return;
                }
                else if (String.IsNullOrWhiteSpace(command) || command[0] != '/')
                {
                    continue;
                }

                var message = Message.CreateMessage(command);

                socket.Send(message);
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            ClientSocket socket = new ClientSocket();

            socket.Connect("127.0.0.1", 1043);
            GetInfo();
            Command command = Command.None;

            while (true)
            {
                switch (command)
                {
                case Command.None:           { HandleNone(ref command); } break;

                case Command.NewGame:        { HandleNewGame(ref command, socket); } break;

                case Command.Quit:           { HandleQuit(ref command, socket); } break;

                case Command.ChooseMethod:   { HandleChooseMethod(ref command); } break;

                case Command.InputMethod:    { HandleInputMethod(ref command, socket); } break;

                case Command.GenerateMethod: { HandleGenerateMethod(ref command, socket); } break;

                case Command.Concede:        { HandleConcede(ref command, socket); } break;
                }
            }
        }
Example #3
0
 public ClientForm()
 {
     InitializeComponent();
     CheckForIllegalCrossThreadCalls = false;
     client = new ClientSocket(this);
     queue = new Queue<string>();
     client.Connect();
 }
        static void Main(string[] args)
        {
            ClientSocket.Connect("127.0.0.1", 6556);

            while (true)
            {
                string  msg    = Console.ReadLine();
                Message packet = new Message(msg);
                ClientSocket.Send(packet.Data);
            }
        }
Example #5
0
        private static void BoltClientSocket()
        {
            _clientSocket = new ClientSocket();
            _clientSocket.Connect("tcp://127.0.0.1:9900");
            _clientSocket.MessageProcessor.MessageBroker.Subscribe<RequestMessage>(MessageHandler);
            _cancellationToken = new CancellationTokenSource();

            Task.Factory.StartNew(SendMessages, _cancellationToken.Token);

            Console.ReadLine();
            _clientSocket.Close();
        }
Example #6
0
 /// <summary>
 /// Need to improve this into a form of callback messaging system
 /// </summary>
 /// <param name="response"></param>
 public void Connect()
 {
     clientSocket.Connect();
 }