Search code examples
socketsasynchronousselectcallbackasynccallback

Does callback feature use select() call, internally?


In the below sample jquery code:

function getData() { 
   $.ajax({ 
             url : 'example.com', 
             type: 'GET', 
             success : handleData 
         }) 
}

Does select() system call on a socket that receives data, help invoke callback handleData() ?


Solution

  • It depends. This might be select, poll, kqueue, epoll etc - which are kind of similar mechanisms but not the same and which differ in scalability and availability on a specific platform. What they all provide is to trigger some kind of event or state change when a sockets gets ready for read or write and this can then be associated with some action like some callback.