[swift-users] Pointer conversions between different sockaddr types
bouke at haarsma.eu
Tue Mar 21 15:52:36 CDT 2017
Hi Quinn, and others,
I found that this code is still featured on swift.org
(https://swift.org/migration-guide/se-0107-migrate.html), but it
doesn't compile anymore. There's a fix-it for adding @escaping, but
also compile errors due to invalid casts. Can someone have a look at
fixing this code?
On 2016-08-22 16:31:58 +0000, Quinn \"The Eskimo!\" via swift-users said:
> On 18 Aug 2016, at 08:28, Quinn The Eskimo! via swift-users
> <swift-users at swift.org> wrote:
>> In my case I introduced an abstract `Address` type (basically a wrapper
>> around `sockaddr_storage`) and then added a method to that object which
>> calls a closure with the right parameters (actually, multiple such
>> methods, depending on whether I’m calling something like `connect`
>> which takes an address, or `getpeername`, which returns one). This
>> approach concentrates all the ugly in one place, making the rest of my
>> BSD Sockets code much cleaner.
> I’ve been revisiting this issue recently and decided to tidy up my code
> enough to share with others. It’s pasted in below. Bon apétit!
> Share and Enjoy
More information about the swift-users