Show: Delphi C++
Display Preferences

System.Win.ScktComp.TCustomWinSocket.SendBuf

From XE2 API Documentation
Jump to: navigation, search

Delphi

function SendBuf(var Buf; Count: Integer): Integer;

C++

int __fastcall SendBuf(void *Buf, int Count);

Properties

Type Visibility Source Unit Parent
function public
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TCustomWinSocket

Description

Writes Count bytes to the socket connection from the Buf parameter.

Use SendBuf to write to the socket connection. Call this method from the OnSocketEvent event handler of a Windows socket object or in the OnWrite or OnClientWrite event handler of a socket component. Alternately, use SendBuf to write when a connection is first formed. Use SendBuf when the socket does not expect notification that the socket on the other end of the connection is waiting to read.

For nonblocking sockets, the data is sent to the WinSock DLL, which has its own internal buffers. If the WinSock can accept additional data, SendBuf immediately returns, with the number of bytes queued. If the WinSock internal buffer space is not able to accept the buffer being sent, SendBuf returns -1 and no data is queued. In this case, wait for the WinSock to send out already queued data, then try again.

For blocking sockets, SendBuf returns the number of bytes actually written.

If an error occurs while writing to the connection, SendBuf terminates the connection and raises an ESocketError exception.

See Also

Personal tools
Previous Versions
Translations