DavidS 0 Posted April 25, 2019 Using old TWSocket 5.31 Using .Receive in an OnDataAvailable procedure works great. When I try .ReceiveFrom, it hangs the code and has to be killed with task manager. Is there any way of making .ReceiveFrom non blocking? Thanks for any help. Share this post Link to post
Angus Robertson 574 Posted April 26, 2019 TWSocket 5.31 goes back 11 years, but ReceiveFrom is essentially the same today. However it is no longer supported. ReceiveFrom is async and returns immediately, it is normally used for UDP only so you know where the data has come from. it is widely used today and does not cause applications to lock up. It sound like you have a continuous loop reading data without any error handling. Angus Share this post Link to post
DavidS 0 Posted April 28, 2019 Thank you for your reply. Yes it is for UDP messages. Currently using .Receive inside an OnDataAvailable procedure and it works fine, retrieving the message contents. This is obviously only called when data is available. If .Receive is simply replaced with .ReceiveFrom, and a message arrives, then execution disappears into TWSocket code and never returns. Putting it in a try except does not help. Maybe there is another way I can retrieve the senders address? Share this post Link to post
Angus Robertson 574 Posted April 29, 2019 No other way to get the remote UDP address, since there is no connection. All UDP applications use ReceiveFrom, it has always worked. Suggest you upgrade to a modern supported version of ICS, but you will need to change your application, all the unit names changed 10 years ago. Angus Share this post Link to post