i´m reading some data from a socket object and when i call the read method
it returns 0 bytes to my byte array.
my code:
private void processRequest(){
byte[] buffer;
int numBytes = this._userSocket.Available;
if(numBytes > maxHeaderBytes){
numBytes = maxHeaderBytes;
}
buffer = new byte[numBytes];
try{
this._userSocket.Receive(buffer,0,numBytes,0); // HERE IS RETURNED AN EMPTY
ARRAY!!! AND Avaliable Property says that exists for exa,ple 800 bytes do be
read.
this._pacoteHttp = this._encoder.GetString(buffer);
if(this._pacoteHttp != String.Empty){
this.extractHeader();
}else{
throw new RequisicaoVaziaException("Empty request(??) " +
this._userSocket.Available + " bytes to be read",this._userSocket);
}
}
catch(SocketException ex){
throw new ConexaoEncerradaException("Connection closed" + ex.ToString());
}
}