Can i recevied a int on StreamReader Sockets C#?
I am developed a app client in java data send a int by sockets to app server in C# but i don't know how can i recevied a int. Because if i put a int mensagem = sr.ReadLine() not work !
The code of server app in C#:
//Some code not include.
public void Server()
{
Socket soc = listener.AcceptSocket();
//Informa uma conecção
//MessageBox.Show("Conectado: " + soc.RemoteEndPoint);
try
{
Stream s = new NetworkStream(soc);
StreamReader sr = new StreamReader(s);
StreamWriter sw = new StreamWriter(s);
sw.AutoFlush = true; // enable automatic flushing
while (true)
{
string mensagem = sr.ReadLine(); //if i put int message not work why?
comando(mensagem);
}
//s.Close();
}
catch (Exception e)
{
MessageBox.Show("Erro!" + e.Message);
}
//MessageBox.Show("Disconectado: " + soc.RemoteEndPoint);
//soc.Close();
} //Fim Função Server