Hi all

It's the first time I write here, I'm a FreePascal programmer on linux (mint) x64

I've posted an issue here
https://sourceforge.net/tracker/?func=detail&aid=3605303&group_id=125224&atid=701386

and I'm here to give more details:

debugging my little case:
        ftpsend.FtpGetFile('ftp.freepascal.org',
                           '21',
                           'pub/fpc/dist/2.6.0/bootstrap/x86_64-linux-ppcx64.bz2',
                           '/tmp/TMP000044.tmp',
                           'anonymous',
                           'f...@example.org') 

I found where my malfunction begins: in blcksock unit, Connect procedure.

procedure TBlockSocket.Connect(IP, Port: string);
var
  Sin: TVarSin;
  b: boolean;
begin
  SetSin(Sin, IP, Port); 
// **** download fails when returning from here
  if FLastError = 0 then  // **** here FLastError values 1
  begin
    if FSocket = INVALID_SOCKET then
      InternalCreateSocket(Sin);
    if FConnectionTimeout > 0 then
    begin
      // connect in non-blocking mode
      b := NonBlockMode;
      NonBlockMode := true;
      SockCheck(synsock.Connect(FSocket, Sin));
      if (FLastError = WSAEINPROGRESS) OR (FLastError = WSAEWOULDBLOCK) then
        if not CanWrite(FConnectionTimeout) then
          FLastError := WSAETIMEDOUT;
      NonBlockMode := b;
    end
    else
      SockCheck(synsock.Connect(FSocket, Sin));
    if FLastError = 0 then
      GetSins;
    FBuffer := '';
    FLastCR := False;
    FLastLF := False;
  end;
  ExceptCheck;
  DoStatus(HR_Connect, IP + ':' + Port);
end;                 


In SetSin:
procedure TBlockSocket.SetSin(var Sin: TVarSin; IP, Port: string);
var
  f: TSocketFamily;
begin
  DoStatus(HR_ResolvingBegin, IP + ':' + Port);
  ResetLastError;
  //if socket exists, then use their type, else use users selection
  f := SF_Any;
  if (FSocket = INVALID_SOCKET) and (FFamily = SF_any) then
  begin
    if IsIP(IP) then
      f := SF_IP4
    else
      if IsIP6(IP) then
        f := SF_IP6;
  end
  else
    f := FFamily;
  FLastError := synsock.SetVarSin(sin, ip, port, FamilyToAF(f),
    GetSocketprotocol, GetSocketType, FPreferIP4); // *** this line sets
FLastError to 1
  DoStatus(HR_ResolvingEnd, GetSinIP(sin) + ':' + IntTostr(GetSinPort(sin)));
end;             



More Info: I don't know if useful but, in Connect procedure, before entering in SetSin, follow Sin content
record TVARSIN {
  ADDRESSFAMILY = 32767,
  SIN_FAMILY = 32767,
  SIN_PORT = 0,
  SIN_ADDR = {
    S_ADDR = 4027126592,
    S_BYTES = {
      64,
      19,
      9,
      240}},
  SIN_ZERO = #255#127#0#0#184'('#173,
  SIN6_PORT = 0,
  SIN6_FLOWINFO = 4027126592,
  SIN6_ADDR = {
    U6_ADDR8 = {
      255,
      127,
      0,
      0,
      184,
      40,
      173,
      0,
      0,
      0,
      0,
      0,
      80,
      166,
      247,
      247},
    U6_ADDR16 = {
      32767,
      0,
      10424,
      173,
      0,
      0,
      42576,
      63479},
    U6_ADDR32 = {
      32767,
      11348152,
      0,
      4160202320},
    S6_ADDR8 = {
      -1,
      127,
      0,
      0,
      -72,
      40,
      -83,
      0,
      0,
      0,
      0,
      0,
      80,
      -90,
      -9,
      -9},
    S6_ADDR = {
      -1,
      127,
      0,
      0,
      -72,
      40,
      -83,
      0,
      0,
      0,
      0,
      0,
      80,
      -90,
      -9,
      -9},
    S6_ADDR16 = {
      32767,
      0,
      10424,
      173,
      0,
      0,
      -22960,
      -2057},
    S6_ADDR32 = {
      32767,
      11348152,
      0,
      -134764976}},
  SIN6_SCOPE_ID = 32767}



thanks in advantage
nomorelogic

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to