Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void buttonEnviar_Click(object sender, EventArgs e)
- {
- byte[] temp = System.Text.Encoding.UTF8.GetBytes(textBoxClient.Text.ToCharArray()); //Convertendo a mensagem para bytes e armazenando
- bufferOfClient = BitConverter.GetBytes(0); //Id do pacote, esse contém apenas uma mensagem
- Buffer.BlockCopy(BitConverter.GetBytes(temp.Length), 0, bufferOfClient, 4, BitConverter.GetBytes(temp.Length).Length); //Armazenando a quantidade de bytes da mensagem
- Buffer.BlockCopy(temp, 0, bufferOfClient, 8, temp.Length); //Armazenando a string
- socketOfClient.Send(bufferOfClient);
- }
Add Comment
Please, Sign In to add comment