<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 3, 2016, at 12:14 PM, Jens Alfke <<a href="mailto:jens@mooseyard.com" class="">jens@mooseyard.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 1, 2016, at 11:48 AM, Tyler Fleming Cloutier via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">libuv and libdispatch overlap on functionality quite a bit, but libdispatch has the benefit of using a block API instead of a function pointer API, which makes memory management easier in Swift. </span></div></blockquote><div class=""><br class=""></div><div class="">I think libdispatch would be the better choice, since it’s what’s going to be used in Swift’s standard library going forward.</div><br class=""><blockquote type="cite" class=""><div class=""><span style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">However, libuv has many additional features for setting up TCP connections and other networking constructs.</span><br style="font-family: Alegreya-Regular; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""><div class="">The dispatch_io API lets you use libdispatch with file descriptors, so working with TCP would just involve making the usual system calls to open the connection and then creating a dispatch_io_t from the FD. It should just take a couple of lines of code.</div></div></div></blockquote><div><br class=""></div><div>Indeed!</div><div><br class=""></div><div><a href="https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/TCP.swift" class="">https://github.com/TheArtOfEngineering/Edge/blob/master/Sources/TCP.swift</a></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">—Jens</div></div></div></blockquote></div><br class=""></body></html>