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

What's the difference between:

AContext.Socket.ReadBytes(...); vs AContext.IOHandler.ReadBytes(...); 

Do they work the same way? Or maybe some kind of cache in IOHandler or something like that?

+4
source share
1 answer

Both of them are actually the same method. The Socket property points to the same IOHandler component when it is a TIdIOHandlerSocket remote object (which is the most time-consuming), and is nil otherwise. You should use the IOHandler property directly for most I / O operations, as it offers more flexibility when using Indy with various types of I / O systems. The Socket property is a useful shortcut for socket functions, such as access to IP / port values ​​corresponding to the socket.

+5
source

Source: https://habr.com/ru/post/1385452/


All Articles