login about faq

I would like to just connect up the socket to the other computer and then get a Delphi event every time data has been received.
In the "(Delphi DLL) Asynchronous Sockets - Reading/Writing Data" example it is just looping waiting for data.

I have not found that events are supported for the delphi dll. ( I am missing something)

So does this mean I have to spin up another thread to do the work of checking for in coming data or is there some simpler solution that I am missing.

If I do have to spin up a thread are there any examples?

Thanks

Tom

asked Jul 25 at 17:18

tom_1234's gravatar image

tom_1234
1


I think there are two options:

1) In your application code, create a separate thread to receive on the socket synchronously, and when data arrives you can notify your main UI thread however you may desire.

or

2) Use the Async version of the Chilkat method to receive in a background thread, and then periodically check to see when the task is finished.

I would recommend #1. There are two things you'll need to figure out:

A) How to start a new thread and how to pass information to the function that is called on the started thread.

B) How to pass information from your background thread to the main UI thread (such as when data arrives on the socket).

Once you solve these 2 problems, you'll have these general recipe's in your arsenal for all future Delphi programming, and you'll likely find them useful to re-use over and over. That's why I would recommend #1.

link

answered Aug 09 at 11:50

chilkat's gravatar image

chilkat ♦♦
12.8k317366475

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×62
×20
×7
×5

Asked: Jul 25 at 17:18

Seen: 283 times

Last updated: Aug 09 at 11:50

powered by OSQA