3
I made this code here following some tutorials over the internet.
buttonAbrirConexão.Enabled = false;
TcpListener servidor = new TcpListener(6554);
servidor.Start();
while(true)
{
Thread.Sleep(2500);
if(servidor.Pending())
{
MessageBox.Show("Cliente conectado");
Socket conexão = servidor.AcceptSocket();
socketStream = new NetworkStream(conexão);
escrever = new BinaryWriter(socketStream);
ler = new BinaryReader(socketStream);
escrever.Write("Alguma coisa");
break;
}
}
Before using the ler.Read(),
how do I know if the customer sent me something before? How to know also what he sent? String
? int
?
Is there a way to trigger an asynchronous event whenever a client tries to connect?
You need to read this: http://answall.com/q/101691/101
– Maniero