SendMessage() public method

public SendMessage ( String msg ) : bool
msg String
return bool
示例#1
0
        private void OnDataAvailable(object sender, WaveInEventArgs e)
        {
            var message     = Convert.ToBase64String(e.Buffer);
            var information = new Information(Nickname, message, InformationType.Voice);

            _client.SendMessage(InformationConverter.Serialize(information));
        }
示例#2
0
        private async Task AuthenticateRA()
        {
            TCPClient client = (TCPClient)TCManager.Instance.RAClient;

            if (client == null)
            {
                return;
            }

            await client.SendMessage(Settings.Default.RAUsername);

            await client.SendMessage(Settings.Default.RAPassword.DecryptString(Encoding.Unicode.GetBytes(Settings.Default.Entropy)).ToInsecureString());
        }
    public void SendReturnMessage()
    {
        string messageToSend = MessageBuilders.BuildLobbyMessage();

        m_cooldownTimer = m_cooldownAfterSwitch;
        TCPClient.SendMessage(messageToSend);
    }
    public void SendPingMessage(int x, int y)
    {
        Vector2 convertedCoord = model.PixelPosToTilePos(x, y);
        string  messageToSend  = MessageBuilders.BuildPingMessage(Mathf.FloorToInt(convertedCoord.x), Mathf.FloorToInt(convertedCoord.y));

        TCPClient.SendMessage(messageToSend);
    }
 public void OnStatusChanged(TCPEnd.Status status)
 {
     Debug.Log(status);
     if (status == TCPEnd.Status.READY)
     {
         client.SendMessage("SEND ME DATA");
     }
 }
    public void JoinGame()
    {
        string message = MessageBuilders.BuildJoinGameMessage(gameId);

        if (message != "")
        {
            TCPClient.SendMessage(message);
        }
    }
示例#7
0
    public void SendMapChangeRequest(int index)
    {
        string message = MessageBuilders.BuildChangeMapMessage(GameLobbyData.MapList[index]);

        if (message != "")
        {
            TCPClient.SendMessage(message);
        }
    }
示例#8
0
    public void SendLeaveGameRequest()
    {
        string message = MessageBuilders.BuildLeaveGameMessage();

        if (message != "")
        {
            TCPClient.SendMessage(message);
        }
    }
示例#9
0
    public void SendRoleChangeRequest(int roleId)
    {
        string message = MessageBuilders.BuildChangeRoleMessage(roleId);

        if (message != "")
        {
            TCPClient.SendMessage(message);
        }
    }
示例#10
0
    public void SendGameStartRequest()
    {
        string message = MessageBuilders.BuildStartGameMessage();

        if (message != "")
        {
            TCPClient.SendMessage(message);
        }
    }
    public void SendGameCreateRequest()
    {
        string messageToSend = MessageBuilders.BuildCreateGameMessage();

        if (messageToSend != "")
        {
            TCPClient.SendMessage(messageToSend);
        }
    }
    public void SendGameListRequest()
    {
        string messageToSend = MessageBuilders.BuildGameListMessage();

        if (messageToSend != "")
        {
            TCPClient.SendMessage(messageToSend);
            lastRefresh = 0f;
        }
    }
示例#13
0
        static void StartClient()
        {
            Console.WriteLine("Choose a username:"******">");
            string username = Console.ReadLine();

            Console.WriteLine("\nServer IP:");
            Console.Write(">");
            string    serverIP = Console.ReadLine();
            TCPClient client   = new TCPClient(username, serverIP);

            client.NewMessage += DisplayMessage;
            client.Start();
            while (true)
            {
                client.SendMessage(Console.ReadLine());
            }
        }
        void SendMessage(object sender, System.EventArgs e)
        {
            CreateMessageBox("You: " + entryMessage.Text);

            var message = (_role.Equals("client") ? "Person In Need:" : "Angel:") + entryMessage.Text;

            if (_role.Equals("client"))
            {
                TCPClient.SendMessage(message);
            }
            else
            {
                TCPServer.SendMessage(message);
            }

            //Remove the text from the entry field
            entryMessage.Text = "";
        }
示例#15
0
        static void TestServerAndClient()
        {
            string         ip       = "127.0.0.1";
            int            port     = 4040;
            ServerListener listener = new ServerListener(ip, port);
            TCPServer      server   = new TCPServer(ip, port, listener);

            Thread.Sleep(2000);

            TCPClient client = new TCPClient(ip, port, new ClientListener());

            client.ConnectToTCPServer();

            Thread.Sleep(2000);

            while (true)
            {
                client.SendMessage("Client msg.");
                Thread.Sleep(1000);
            }
        }
        async void Handle_Clicked(object sender, System.EventArgs e)
        {
            var result = await DisplayAlert("Alert",
                                            "You are about to leave the chat and " +
                                            "will not be able to return. Are you " +
                                            "sure you wish to disconnect yourself " +
                                            "and the other person?",
                                            "Yes", "No");

            if (result)
            {
                if (_role.Equals("client"))
                {
                    TCPClient.SendMessage("!DISCONNECT");
                }
                else
                {
                    TCPServer.SendMessage("!DISCONNECT");
                }

                CloseChat();
            }
        }
示例#17
0
 public static bool SendMessage(NetworkPacket coms)
 {
     return(client.SendMessage(coms));
 }
    public void SendMoveMessage(string direction)
    {
        string messageToSend = MessageBuilders.BuildMovementMessage(direction);

        TCPClient.SendMessage(messageToSend);
    }
    public void SendActionMessage()
    {
        string messageToSend = MessageBuilders.BuildActionMessage();

        TCPClient.SendMessage(messageToSend);
    }