Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi: Socket.ReadBytes(); vs IOHandler.ReadBytes()

Whats the difference between:

AContext.Socket.ReadBytes(...);

 vs

AContext.IOHandler.ReadBytes(...);

Do they work the same ? Or maybe some cache in IOHandler or something?

like image 776
jmp Avatar asked Dec 09 '11 01:12

jmp


1 Answers

The two are actually the exact same method. The Socket property points to the same IOHandler component when it is a TIdIOHandlerSocket-derived object (which is most of the time), and is nil otherwise. You should use the IOHandler property directly for most I/O operations, as it offers more flexibility to use Indy with different types of I/O systems. The Socket property is a useful shortcut for socket-specific functionality, like accessing the socket's associated IP/Port values.

like image 134
Remy Lebeau Avatar answered Sep 21 '22 03:09

Remy Lebeau