Jump to content

Search the Community

Showing results for tags 'tidtcpserver'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. I have this code where I send an jpg image with TidTCPClient to a TidTCPServer. On the Server side the image aperea in a TImage, but no file is created when I save it. I tried using .jpg as well I try to use the MemoryStream.SaveToFile. I look in many forums and it looks like the do the same thing, what is wrong with this code? Here is the server code. procedure TMainForm.IdTCPServer1Execute(AContext: TIdContext); var JSON: TJSONObject; StringStream: TStringStream; MemoryStream: TMemoryStream; begin MemoryStream := nil; StringStream := nil; JSON := nil; try StringStream := TStringStream.Create('', TEncoding.ASCII); AContext.Connection.IOHandler.LargeStream := True; AContext.Connection.IOHandler.ReadStream(StringStream, SizeOf(StringStream), True); JSON := TJSONObject.ParseJSONValue(StringStream.DataString) as TJSONObject; MemoryStream := TMemoryStream.Create; IdDecoderMIME1.DecodeStream(JSON.GetValue('image_encoded').Value, MemoryStream); TThread.Synchronize(nil, procedure begin Edit2.Text := ''; Edit2.Text := JSON.GetValue('message').Value; Image1.Bitmap.LoadFromStream(MemoryStream); end); finally MemoryStream.Free; StringStream.Free; JSON.Free; end; SaveImageToDisk; end; procedure TMainForm.SaveImageToDisk; var CsFilename: String; begin CsFilename := Edit2.Text + '.png'; Image1.Bitmap.SaveToFile(CsFilename); end;
  2. shineworld

    TCP/IP Server with OpenSSL TLS 1.2

    After finishing and testing the configuration to have TLS 1.2 on TIdFTPServer I was asked to add OpenSSL and TLS 1.2 also on the API server (based on TIdTCPServer TCP/IP communication). Unfortunately when I set Active to True, and IdSSLOpenSSL.InitContext is called, in the CiperList settings step it always returns error = 1 and I don't understand what I am doing wrong: if StatusInfoOn then begin SSL_CTX_set_info_callback(fContext, InfoCallback); end; //if_SSL_CTX_set_tmp_rsa_callback(hSSLContext, @RSACallback); if fCipherList <> '' then begin {Do not Localize} error := SSL_CTX_set_cipher_list(fContext, {$IFDEF USE_MARSHALLED_PTRS} M.AsAnsi(fCipherList).ToPointer {$ELSE} PAnsiChar( {$IFDEF STRING_IS_ANSI} fCipherList {$ELSE} AnsiString(fCipherList) // explicit cast to Ansi {$ENDIF} ) {$ENDIF} ); end else begin // RLebeau: don't override OpenSSL's default. As OpenSSL evolves, the // SSL_DEFAULT_CIPHER_LIST constant defined in the C/C++ SDK may change, // while Indy's define of it might take some time to catch up. We don't // want users using an older default with newer DLLs... (* error := SSL_CTX_set_cipher_list(fContext, {$IFDEF USE_MARSHALLED_PTRS} M.AsAnsi(SSL_DEFAULT_CIPHER_LIST).ToPointer {$ELSE} SSL_DEFAULT_CIPHER_LIST {$ENDIF} ); *) error := 1; end; Server code: https://pastebin.com/z82zhGyQ I am using the latest Indy sources from the git repository. I thank you in advance for any suggestions Best Regards Silverio
×