Hola a todos,
tengo este codigo que lo que hace es leer las respuestas a los comandos FTP,
por lo que siempre retorna un string. El tema es que en cierto momento se
queda colgado en la linea:
bytes = clientSocket.Receive(buffer, buffer.Length, SocketFlags.None);
No sale de ahi, no da error no hace nada, esto lo hace luego de haber
transferido varios archivosy no es siempre la misma cantidad.
Gracias de antemano por la ayuda que puedan brindar!!
private string readLine()
{
System.Timers.Timer oT = new System.Timers.Timer();
while(true)
{
bytes = clientSocket.Receive(buffer, buffer.Length, SocketFlags.None);
mes += ASCII.GetString(buffer, 0, bytes);
if(bytes < buffer.Length || bytes == 0 )
{
break;
}
}
char[] seperator = {''};
string[] mess = mes.Split(seperator);
if(mes.Length > 2)
{
mes = mess[mess.Length-2];
}else{
mes = mess[0];
}
if ( mes.Length >= 3 )
{
if(!mes.Substring(3,1).Equals(" "))
{
return readLine();
}
}else{
return "";
}
string a = "";
if(debug)
{
for(int k=0 ; k < mess.Length - 1 ; k++ ){
a += mess[ k ];
}
return a;
}
contador -= 1;
return mes;
}
Leer las respuestas