From RAD Studio API Documentation
Jump to: navigation, search



TWinSocketStream = class(TStream)


class PASCALIMPLEMENTATION TWinSocketStream : public System::Classes::TStream


Type Visibility Source Unit Parent
class public
System.Win.ScktComp System.Win.ScktComp


TWinSocketStream is a stream that provides services which allow applications to read from or write to socket connections.

Use TWinSocketStream to read or write information over a blocking socket connection. Windows socket objects include methods to read from or write to the socket connection they represent. However, these methods do not provide a mechanism for timing out when the socket connection is dropped or for waiting until the socket connection is ready before reading.

When the socket is a non-blocking socket, this lack of a time-out or waiting mechanism is not a problem, because reading and writing occur asynchronously in response to notifications from the socket connection. For blocking sockets, however, these mechanisms provided by TWinSocketStream are necessary so that the application using the socket does not hang indefinitely.

To use a Windows socket stream, create an instance of TWinSocketStream, use the methods of the stream to read or write the data, and then free the Windows socket stream.

Note: TWinSocketStream does not work with non-blocking sockets.

See Also