HI for all, i do a prototype to transfer a imagem overt internet with Twsocket,
but in local network works fine, but when i test with a remote computer in 
internet connection
the file is sended but dont receive or receive a image with lost collor.

sending ...
    try
      FMS.Seek(0, soBeginning);
      Form10.wscktsrvr1.Client[0].SendStr('IMAGE:' + IntToStr(FMS.Size) + 
sLineBreak);
      Form10.wscktsrvr1.Client[0].Send(FMS.Memory, FMS.Size);
    finally
Receiving ...
if (FIsBiniary) then begin
    iCount := Socket3.Receive(FRcvd + FWritePtr, FFileSize - FWritePtr);
    Inc(FWritePtr, iCount);

    if (iCount = 0) then begin
      FIsBiniary := False;
    end;
    if FWritePtr = FFileSize then begin
      F := TMemoryStream.Create();
      try
        F.Write(FRcvd[0], FFileSize);
        Memo1.Lines.Add('write');
      finally
        oBMP := TBitmap.Create;
        f.Seek(0, soBeginning);
        oBMP.LoadFromStream(F);
        Image1.Picture.Assign(oBMP);
        FreeMem(FRcvd, FFileSize);
        FreeAndNil(oBMP);
        F.Free;
      end;

      FIsBiniary := False;
      Socket3.LineMode := True;
    end;
    Exit;
  end;

  sRcvBuf := Socket3.ReceiveStr.Trim;
  Memo1.Lines.Add(sRcvBuf);

  if (sRcvBuf.StartsWith('IMAGE001:')) then begin
    sRcvBuf := sRcvBuf.Substring(9);
    Memo1.Lines.Add('Size: '  + sRcvBuf);

    FFileSize := StrToIntDef(sRcvBuf, 0);
    FWritePtr := 0;
    GetMem(FRcvd, FFileSize);
    Socket3.LineMode := False;
    FIsBiniary := True;
  end;
end;

someone can help-me ?

Sent from [ProtonMail](https://protonmail.ch), encrypted email based in 
Switzerland.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to