Board index » delphi » Novice at TServerSocket & TClientSocket

Novice at TServerSocket & TClientSocket

I'm trying to learn how to use TClientSocket & TServerSocket w/ Delphi 3.
I've successfully made a non-blocking connection between the client
& server.  (w/ IP=127.0.0.1 on Port=1516)

On the Client on a buttonclick event I have....
   ClientSocket1.Socket.SendText('Hello from Client');
which works fine.

On the Server on a button click event I have...
   ServerSocket1.Socket.SendText('Hello from Server');
...this results in the error.. "Windows socket error (10057) on API send"

How can I send data from the Server to the Client?

Thank you,
-Mark

 

Re:Novice at TServerSocket & TClientSocket


Quote
In article <8v6cbh$1...@bornews.inprise.com>, Mark L wrote:
> I'm trying to learn how to use TClientSocket & TServerSocket w/ Delphi 3.
> I've successfully made a non-blocking connection between the client
> & server.  (w/ IP=127.0.0.1 on Port=1516)

> On the Client on a buttonclick event I have....
>    ClientSocket1.Socket.SendText('Hello from Client');
> which works fine.

> On the Server on a button click event I have...
>    ServerSocket1.Socket.SendText('Hello from Server');
> ....this results in the error.. "Windows socket error (10057) on API send"

> How can I send data from the Server to the Client?

You can only do that if you have a connected client, otherwise the server
socket has no idea where to send to. If you have a connection going you can
use the socket returned by serversocket1.sockets.connections[ someindex ] to
write to. Look at the Chat demo program, it shows how to work with
nonblocking sockets.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Other Threads