TServerSocket in thread

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

TServerSocket in thread

Postby rajesh » Tue Apr 05, 2016 3:42 am

Is that possible to use TServerSocket in thread I.e a class derived from TThread in c++builder6 . In Main Thread its events stop while doing some other processing
rajesh
Top Poster
Top Poster
 
Posts: 44
Joined: Mon Oct 26, 2009 1:25 am

Re: TServerSocket in thread

Postby rlebeau » Tue Apr 05, 2016 5:24 pm

rajesh wrote:Is that possible to use TServerSocket in thread


Yes. But keep in mind that TServerSocket runs in non-blocking mode by default, and that requires the thread to have its own message loop to handle socket messages. If you don't want that, you will have to put TServerSocket into thread-blocking mode instead, and then use a TWinSockStream for all reads/writes on a connected socket.

rajesh wrote:In Main Thread its events stop while doing some other processing


As it should be, since the main message loop is getting blocked. Which is why you shouldn't be doing any long processing in the main thread to begin with.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1457
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA


Return to Technical

Who is online

Users browsing this forum: No registered users and 14 guests