I am building a Windows Service Application. In this service, I have to build a thread. I have a client socket component dropped into the service. This component must stay in its place, not created in the thread, because a majority of its purpose is running from within the service its self. However, I need to be able to send data through this socket from within this thread.
What would be the best approach? I'm thinking of building a single string buffer in this thread, then in the service, read this buffer and send along anything which may be in this buffer. It would be much easier though if I could directly access this component from within the thread execution. I'm thinking of adding a parameter to the thread's constructor to pass along a pointer to this component, like...
Then, I should be able to access this component from within the thread by using fMySocket.
Right? or Wrong?
Any suggestions?
JD Solutions
What would be the best approach? I'm thinking of building a single string buffer in this thread, then in the service, read this buffer and send along anything which may be in this buffer. It would be much easier though if I could directly access this component from within the thread execution. I'm thinking of adding a parameter to the thread's constructor to pass along a pointer to this component, like...
Code:
constructor TMyThread.Create(ASocket: TJDClientSocket);
begin
//Assign ASocket to a variable within thread...
fMySocket:= ASocket;
end;
Then, I should be able to access this component from within the thread by using fMySocket.
Right? or Wrong?
Any suggestions?
JD Solutions