indy

Indy synchronize ServerTCPExecute

*爱你&永不变心* 提交于 2019-12-17 17:14:43
问题 I'm using TIDTCPServer component. As I understood event ServerTCPExecute(AContext: TIdContext) is not synchronized. What is the best way of synchronising it? I need data to be send to main thread and have them back to format answer. I'm using Indy 10.5.8.0. Method 1 Is it something like this I should deal with critical sections to pass data from non synchronized function to application? var data:string; . . . procedure MainThreadProcedure; begin ... end; . . . procedure IdTCPServerExecute

Indy FTP Failing to upload miserably

自古美人都是妖i 提交于 2019-12-17 16:51:02
问题 Using a simple code, such as: procedure TForm1.cxButton1Click(Sender: TObject); begin ftp.Host := 'domain'; ftp.Username := 'user'; ftp.Password := 'password'; ftp.Connect; ftp.Put('C:\_Projects\testpicture.JPG'); ftp.Quit; ftp.Disconnect; end; I'm getting the following results: Application freezes while uploading (ergo unable to see Progress Bar position). Uploaded file goes corrupted (corrupts anything more than a few bytes). What on earth am I doing wrong? Thank you. 回答1: The app freezes

Proxy server using Indy

让人想犯罪 __ 提交于 2019-12-17 15:57:11
问题 I'm new to Indy and I want to build a simple proxy-server with it. This is a quite big library, and I just don't know where to start. When client connects to server, OnExucute fires up and receives client connection as parameter (AContext.Connection). I want to do following: [client connection] := AContext.Connection read host/port from [client connection] [remote connection] := connect to host/port while both connections alive: if data available in [client connection]: read data from [client

Delphi (XE2) Indy (10) Multithread Ping

南楼画角 提交于 2019-12-17 15:36:52
问题 I have a room with 60 computers/devices (40 computers and 20 oscilloscopes Windows CE based) and I would like to know which and every one is alive using ping. First I wrote a standard ping (see here Delphi Indy Ping Error 10040), which is working fine now but takes ages when most computers are offline. So what I am trying to do is to write a MultiThread Ping but I am quite struggling with it. I have seen only very few examples over the internet and no one was matching my needs, that's why I

Http Post with indy

自作多情 提交于 2019-12-17 12:47:54
问题 I have a simple php script on my web server which I need to upload a file using HTTP POST, which I am doing in Delphi. Here is my code with Indy but aparantely it won't work and I can't figure out what i am not doing properly. How can I view what I send on the server is there such a tool ? procedure TForm1.btn1Click(Sender: TObject); var fname : string; MS,dump : TMemoryStream; http : TIdHTTP; const CRLF = #13#10; begin if PromptForFileName(fname,'','','','',false) then begin MS :=

Step by step upgrade of Indy 10 in Delphi 2009

送分小仙女□ 提交于 2019-12-17 07:26:22
问题 Can someone help in telling the details on how to uninstall Indy 10 and install the latest build? I found it http://indy.fulgan.com/ZIP/IndyTiburon.zip There is a similar question, but not a satisfying answer, just some comments from the user who asked, but that is not a step by step guide. Why there is not a tool for this? 回答1: I did this very recently, I've done it before with 2007 and had lots of problems, but this time in D2010 it went really well... Assumptions: The Indy BPL's are stored

How to send a mail message using Indy's smtp server component?

淺唱寂寞╮ 提交于 2019-12-14 03:41:57
问题 Since the demo given in http://www.indyproject.org/Sockets/Demos/index.EN.aspx only saves the received stream to a file, I don't know how to effectevely send that stream as a mail. Could anyone teach me how to do this or to point me some more complete example? 回答1: A SMTP server component can't send mail - it can only receive it. You need a SMTP client component (TidSMTP) to send mail. A mail server when it sends mail acts like an SMTP client. 回答2: Here's a complete example on how to send an

Twilio or Plivo SMS using Delphi

岁酱吖の 提交于 2019-12-14 02:40:04
问题 I am trying to figure out how to use Delphi 10 Seattle and Indy to send a POST request to either Plivo or Twilio for sending SMS messages. When I use this code for Twilio efforts, I get an Unauthorized message in return (note that I have redacted my user name and Auth code): procedure TSendTextForm.TwilioSendSms(FromNumber, ToNumber, Sms: string; Var Response: TStrings); var apiurl, apiversion, accountsid, authtoken, url: string; aParams, aResponse: TStringStream; mHTTP : TidHttp; begin mHTTP

Upload file with form data using Delphi Indy HTTP component

跟風遠走 提交于 2019-12-14 02:24:39
问题 I want to replicate this part of Python code in Delphi using Indy: postdata = {'data': '{"data":{"xMode":0,"overrideOS":1,"messageId":"","vmProfileList":"11","submitType":"0","url":""},"filePriorityQ":"run_now" }'} file_up = {'amas_filename':open('/home/samples/temp/vtest32.exe','r')} file_upload_req=requests.post(url,postdata,files=file_up,headers=headers,verify=False) I tried it like this: Params.AddFormField('data', '{"data":{"xMode": '+ xMode +',"analyzeAgain":1,"overrideOS":1,' + '

empty buffer but IdTCPClient.IOHandler.InputBufferIsEmpty is false

半腔热情 提交于 2019-12-14 01:44:32
问题 I have problem in below code with idTCPClient for reading buffer from a telnet server: procedure TForm2.ReadTimerTimer(Sender: TObject); var S: String; begin if IdTCPClient.IOHandler.InputBufferIsEmpty then begin IdTCPClient.IOHandler.CheckForDataOnSource(10); if IdTCPClient.IOHandler.InputBufferIsEmpty then Exit; end; s := idTCPClient.IOHandler.InputBufferAsString(TEncoding.UTF8); CheckText(S); end; this procedure run every 1000 milliseconds and when the buffer have a value CheckText called.