public void SendMessage(string toUsername, string message) { var requestMessage = new Gap.Network.Message { Name = "message", Parameters = new string[] { toUsername, message } }; SendRequest(requestMessage); }
public static void Send(Socket socket, Message requestMessage) { socket.Send(requestMessage.ToString()); }
private Gap.Network.Message SendRequest(string requestName, string parameter) { var requestMessage = new Gap.Network.Message { Name = requestName, Parameters = new string[] { parameter } }; return SendRequest(requestMessage); }
private Gap.Network.Message SendRequest(string requestName) { var requestMessage = new Gap.Network.Message { Name = requestName }; return SendRequest(requestMessage); }
public void ProcessRequest() { var requestMessage = Message.Receive(this.ClientTransmitterSocket); var responseMessage = new Message(); switch (requestMessage.Name) { case "login": this.Login(requestMessage.Parameters[0]); break; case "getOnlineUsers": responseMessage.Parameters = OnlineUsersButMe().Select(x => x.Name).ToArray(); break; case "logout": this.Logout(); break; case "IntroReceiverPort": int clientReceiverPort = int.Parse(requestMessage.Parameters[0]); ConnectToClient(clientReceiverPort); break; case "message": SendMessage(requestMessage.Parameters[0], requestMessage.Parameters[1]); break; } Message.Send(ClientTransmitterSocket, responseMessage); }