RAD Studio |  |

Responding to Socket Events
See Also
Collapse All

When writing applications that use sockets, you can write or read to the socket anywhere in the program. You can write to the socket using the SendBuf, SendStream, or Sendln methods in your program after the socket has been opened. You can read from the socket using the similarly-named methods ReceiveBuf and Receiveln. The OnSend and OnReceive events are triggered every time something is written or read from the socket. They can be used for filtering. Every time you read or write, a read or write event is triggered.

Both client sockets and server sockets generate error events when they receive error messages from the connection.

Socket components also receive two events in the course of opening and completing a connection. If your application needs to influence how the opening of the socket proceeds, you must use the SendBuf and ReceiveBuf methods to respond to these client events or server events.

See Also

Implementing Services

Types of Socket Connections

Describing Sockets

Using Socket Components

Reading and Writing Over Socket Connections

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!