Not sure if this was accepted first attempt as I cleverly mailed from the
wrong email address!


Hi - after pulling out a lot of hair, I'm hoping someone can take pity on a
poor, struggling programmer who needs some help J


I'm not a beginner with Delphi but I'm definitely not an expert either so
I'm really struggling to create a DLL-based WSocket client that does what I


I've spent the last couple of days tinkering with the DLL 1 example but just
can't get it to function so I'm hoping that someone can assist.


Basically what I'm trying to do is implement 4 functions that can be called
safely from my app:


Connect(), Connected(), Disconnect() and GetMessage()


Connect() needs to be passed the host, the port, the username, the handle of
the calling child window and a "pump rate"


What I need Connect() to do is kick off a worker thread that continues
running and manages the socket connection without blocking the calling
process as the current DLL example does.


That worker thread should:

1)      Connect the socket to the host

2)      SendStr() the username


.then sit in a loop where it:

3)      Monitors for incoming messages and adds each message to a

4)      Fires off a PostMessage() to the specified window of the main
application every "pump rate" milliseconds



Connected() simply returns the connection status of the socket


GetMessage() returns information from the TStringList


Disconnect() signals the worker thread to gracefully drop the connection (if
possible) and close down



>From the application perspective, it would call the Connect() function,
monitor the connection status via Connected(), obtain incoming messages via
GetMessage() and call Disconnect() as required.


One of the difficulties seems to be that the socket would be running within
the worker thread but the functions and data that I need to access would be
in the global scope.


As I said, I'm hoping someone can help me with this - I know what I need it
to do but seem to have passed the point where my coding skills let me do it.


Regards, Adam



To unsubscribe or change your settings for TWSocket mailing list
please goto
Visit our website at

Reply via email to