TCP / Client Sockets C#

  • Thread starter Thread starter dianas28
  • Start date Start date
D

dianas28

Guest
Good night i have seen tutoriales to understand this issue I see it very complicated I am something new in this please be patient, the problem I have is that I want to obtain a number from server though this

string respuesta = System.Text.Encoding.ASCII.GetString(TiraIn);

But when I try to get the number to make a button visible, I can not do it, can you please help me, this is my code.


NetworkStream serverStream = clientSocket.GetStream();
// byte[] outStream = System.Text.Encoding.ASCII.GetBytes("Message from Client$");
byte[] TiraOut = System.Text.Encoding.ASCII.GetBytes(txtServidor.Text + "$");
serverStream.Write(TiraOut, 0, TiraOut.Length);
serverStream.Flush();

byte[] TiraIn = new byte[10025];
// serverStream.Read(TiraIn, 0, (int)clientSocket.ReceiveBufferSize);
serverStream.Read(TiraIn, 0, 10024);
string respuesta = System.Text.Encoding.ASCII.GetString(TiraIn);
msg("Resp.Server : " + respuesta);

if (respuesta == "2")
{
button1.Visible = true;
}

Continue reading...
 
Back
Top