Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 09-07-2015
Avatar de cesarsoftware
cesarsoftware cesarsoftware is offline
Miembro
 
Registrado: nov 2006
Posts: 241
Poder: 18
cesarsoftware Va por buen camino
¿Conoces el tamaño de la cadena en origen?
Si no puedes usar esta función e ir incrementado el buffer recibido
Código Delphi [-]
    if ioctlsocket(nSocket, FIONREAD , &InBuffer) = SOCKET_ERROR then
    begin
      case WSAGetLastError of
        WSANOTINITIALISED: ErrorString := 'A successful WSAStartup call must occur before using this function.';
        WSAENETDOWN: ErrorString := 'The network subsystem has failed.';
        WSAEINPROGRESS: ErrorString := 'A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.';
        WSAENOTSOCK: ErrorString := 'The descriptor s is not a socket.';
        WSAEFAULT: ErrorString := 'The argp parameter is not a valid part of the user address space.';
      end;
      Break;
    end;
    if InBuffer > 65536 then // 64k es el maximo rendimiento y el tamaño del array
      InBuffer := 65536;     // el resto quedara para la siguiente lectura
    // para detectar desconexion, no se puede comprobar si hay algo en buffer
    rxLen := recv(nSocket, RxBuffer, InBuffer, 0);
    if (rxLen = SOCKET_ERROR) or (rxLen = 0) then
    begin
      case WSAGetLastError of
        WSANOTINITIALISED: ErrorString := 'A successful WSAStartup call must occur before using this function.';
        WSAENETDOWN: ErrorString := 'The network subsystem has failed.';
        WSAEFAULT: ErrorString := 'The buf parameter is not completely contained in a valid part of the user address space.';
        WSAENOTCONN: ErrorString := 'The socket is not connected.';
        WSAEINTR: ErrorString := 'The (blocking) call was canceled through WSACancelBlockingCall.';
        WSAEINPROGRESS: ErrorString := 'A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.';
        WSAENETRESET: ErrorString := 'The connection has been broken due to the keep-alive activity detecting a failure while the operation was in progress.';
        WSAENOTSOCK: ErrorString := 'The descriptor is not a socket.';
        WSAEOPNOTSUPP: ErrorString := 'MSG_OOB was specified, but the socket is not stream-style such as type SOCK_STREAM, OOB data is not supported in the communication domain associated with this socket, or the socket is unidirectional and supports only send operations.';
        WSAESHUTDOWN: ErrorString := 'The socket has been shut down; it is not possible to receive on a socket after shutdown has been invoked with how set to SD_RECEIVE or SD_BOTH.';
        WSAEWOULDBLOCK: ErrorString := 'The socket is marked as nonblocking and the receive operation would block.';
        WSAEMSGSIZE: ErrorString := 'The message was too large to fit into the specified buffer and was truncated.';
        WSAEINVAL: ErrorString := 'The socket has not been bound with bind, or an unknown flag was specified, or MSG_OOB was specified for a socket with SO_OOBINLINE enabled or (for byte stream sockets only) len was zero or negative.';
        WSAECONNABORTED: ErrorString := 'The virtual circuit was terminated due to a time-out or other failure. The application should close the socket as it is no longer usable.';
        WSAETIMEDOUT: ErrorString := 'The connection has been dropped because of a network failure or because the peer system failed to respond.';
        WSAECONNRESET: ErrorString := 'The virtual circuit was reset by the remote side executing a hard or abortive close. The application should close the socket as it is no longer usable.';// On a UPD-datagram socket this error would indicate that a previous send operation resulted in an ICMP "Port Unreachable" message.';
      else
        ErrorString := 'Error Desconocido';
        if RxLen = 0 then
          ErrorString := 'Desconectado';
      end;
      Break;
    end
    else
    begin
      if RxLen > 0 then
      begin
        ErrorString := '';
        Synchronize(recibido);
      end;
    end;
Un saludo.
__________________
Disfruta de la vida ahora, vas a estar muerto mucho tiempo.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
ClientSocket y ServerSocket ZayDun Internet 2 20-06-2011 14:38:57
Serversocket y Clientsocket Dragon Varios 3 03-05-2006 06:11:36
Pasar texto extenso por un formulario D-MO PHP 1 25-01-2006 07:30:36
ClientSocket / serverSocket VRO Varios 2 20-10-2005 18:46:51
¿Convertir los caracteres ASCII del ClientSocket.Socket.ReceiveText? Kamikaze Internet 23 14-07-2005 15:35:39


La franja horaria es GMT +2. Ahora son las 00:16:44.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi