SHARE
TWEET

Untitled

a guest Aug 30th, 2016 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void buttonEnviar_Click(object sender, EventArgs e)
  2. {
  3.     byte[] temp = System.Text.Encoding.UTF8.GetBytes(textBoxClient.Text.ToCharArray()); //Convertendo a mensagem para bytes e armazenando
  4.     bufferOfClient = BitConverter.GetBytes(0); //Id do pacote, esse contém apenas uma mensagem
  5.     Buffer.BlockCopy(BitConverter.GetBytes(temp.Length), 0, bufferOfClient, 4, BitConverter.GetBytes(temp.Length).Length); //Armazenando a quantidade de bytes da mensagem
  6.     Buffer.BlockCopy(temp, 0, bufferOfClient, 8, temp.Length); //Armazenando a string
  7.     socketOfClient.Send(bufferOfClient);
  8. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top