News for hackers. Stuff that matters.
Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @10:39AM (#17265842)
Am I the only one whose first reaction to this is "Oh, great, yet another manner in which my next application won't be cross-platform?"

My second reaction being: "Oh, well, I'll just make it a web app instead of a native app."

edit Rephrased the last sentence.

Re:Network.framework: A modern alternative to sockets by int0x80 on Friday June 08, 2018 @02:06PM (#17268140)
1st thing: The people here asking if they are going to deprecate BSD sockets. No way that is going to happen. We are talking about 30yo+ API deeply integrated in the kernel, unix and userspace. OpenGL/CL is a very very different case. It's always been a third party thing an doesnt have the same level of usage. Not even close.

2. Not everything is a webapp or http. You may absolutely need to use the raw network without any encapsulation. This posibility must simply not die. Its true that most people will not need to use this apis and will use a http webapp.

On the API itself. I think it is a really good idea to make a new generic tcp/udp library. With everything we use today included, and as a first class citizen from the first minute of the design. The particular API they present looks good and it is very well thought out. Mostly integrates async tcp/upd/tls seemless and supports changing interfaces on the fly. This alone is a big improvement. Does this while still providing raw access to the out/input net queues. You can even access the lowlevel details and parameters if you want or need to.

However this is not the first modern network API. QT (qt network) has a good network layer for one. There are simpler alternatives: libuv, libevent etc. This are more speciallized and dont handle all that Network.framework offers.

Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @04:52PM (#17269585)
> 1st thing: The people here asking if they are going to deprecate BSD sockets. No way that is going to happen. We are talking about 30yo+ API deeply integrated in the kernel, unix and userspace. OpenGL/CL is a very very different case. It's always been a third party thing an doesnt have the same level of usage. Not even close.

I agree that removing sockets would break large chunks of the ecosystem. On the other hand, after OpenGL's removal, it's not clear to me that Apple cares anymore about anything outside of Cocoa.

> 2. Not everything is a webapp or http. You may absolutely need to use the raw network without any encapsulation. This posibility must simply not die. Its true that most people will not need to use this apis and will use a http webapp.

Of course. Nearly 100% of my code is not webapp/http. Which is why I'm annoyed when I see (or in this case, fear) cross-platform APIs disappear.

> On the API itself. I think it is a really good idea to make a new generic tcp/udp library. [...]

I have no problem with a new, better, API. But I would certainly be more enthusiastic if any effort was presented to make it cross-platform and, hopefully, open-source and/or standardized.

Re:Network.framework: A modern alternative to sockets by josephg on Saturday June 09, 2018 @05:46AM (#17272255)
> But I would certainly be more enthusiastic if any effort was presented to make it cross-platform and, hopefully, open-source and/or standardized.

They opensourced libdispatch[1] and ported it to linux, so there's hope they might do the same with Network.framework. It would be time consuming, but it shouldn't be hard for someone in the opensource community to write a linux / BSD implementation of this stuff on top of posix sockets & libdispatch.

I suspect the reason they didn't opensource it is that it looks like it was designed mostly with phone apps in mind, not servers. And thats a shame - it looks like it would be a great addition to the swift server story, especially given it does user-space networking out of the box. I still prefer swift's ergonomics over rust for application development, and this would help immensely. (Rust is steadily closing that gap though, what with native wasm support and async/await on their way.)

[1] https://github.com/apple/swift-corelibs-libdispatch

Re:Network.framework: A modern alternative to sockets by int0x80 on Friday June 08, 2018 @05:26PM (#17269842)
I agree. Im not saying this is the solution, but is not a bad API, that is what I say. A cross plat. and OSS would be great, absolutely. But as others have said those apis usually come out of defacto standards that people adopt. Probably adopting an apple library likely with patents and copyright issues is not even an option. But maybe it triggers new ideas and reactions on people on other OSes.

Implementing this (similar functionality) API on Linux on top of libuv/libevent and gnutls + multipath tcp shouldnt be much work. Well, maybe multipath tcp is problematic, I dont know details there.

Re:Network.framework: A modern alternative to sockets by mercutio2 on Friday June 08, 2018 @08:18PM (#17270771)
OpenGL was not removed. It was deprecated. These are very different things.
Re:Network.framework: A modern alternative to sockets by madeofpalk on Friday June 08, 2018 @08:53PM (#17270892)
No cross platform APIs have disappeared! The 'worst' thing that's happened was that a barely supported and never updated API was officially deprecated.
Re:Network.framework: A modern alternative to sockets by jexah on Saturday June 09, 2018 @11:22AM (#17273453)
Note to readers: It was barely supported and never updated on Apple products only, at Apple's discretion. If they supported it properly like they were "supposed to", it wouldn't be barely supported and never updated :)

[0] "Supposed to" is my opinion on OpenGL. At the time it was the only cross-platform graphics API, and with Valve pushing a DirectX to OpenGL converter and building all their games with OpenGL support, we were finally going to get to a standard interface to graphics hardware. I guess that ship has sailed now. At least there will be abstractions that compile to the various platforms.

Re:Network.framework: A modern alternative to sockets by pjmlp on Friday June 08, 2018 @10:43AM (#17265886)
Not everyone cares about cross-platform, some developers rather specialize in a given platform.

You can keep using sockets if that is your thing.

Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @11:07AM (#17266146)
> Not everyone cares about cross-platform, some developers rather specialize in a given platform.

True.

> You can keep using sockets if that is your thing.

For the moment, yes. However, as you know, earlier this week, Apple has officially deprecated OpenGL and OpenCL, a few years after introducing a competing (and admittedly suprerior) API. It is my understanding that Apple has not attempted to get this replacement API standardized, nor to offer it on any other platform. While it's hard to deduce from such a small sample, this precedent does suggest that the days of sockets are numbered.

This would make the life of some of my colleagues quite more complicated, and it would, in time, simply get rid of the macOS version of a number of existing cross-platform applications whose authors have neither the time nor the energy to rewrite the network layer.

Re:Network.framework: A modern alternative to sockets by pjmlp on Friday June 08, 2018 @11:24AM (#17266350)
Every effort to get rid of plain unsafe C APIs is a plus on my book.

Apple has enough business with developers that care about macOS experience, not plain ports from other platforms.

When I buy a computer with a specific OS, I want the experience provided by the OS APIs.

Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @12:28PM (#17267031)
I understand your point. I also dislike a lot these plain unsafe C APIs.

However, I am a developer. When I write an application, I only have so much time to spend on ports. Anything that requires me to have different designs for different platforms is bad for me. So, in the ideal case, we'll end up with a few high-level cross-platform abstractions (which may actually share Network.framework's API, for all I know) on top of networking, and everybody will remain happy. In the worst case, we'll end up with bits of duct tape, or simply with fewer macOS apps.

Also, even as a macOS user, most of the applications I use daily are cross-platform: Firefox, Thunderbird, VSCode, my various compilers & interpreters & debuggers, VLC, Gitter, Open Office, Terminal, games, etc. In fact, looking at my recent applications, the only single-platform applications I seem to be using are Keychain, SimpleComic, Instruments (the only one in the list to particularly integrate with the OS), Notes, Calendar. I sometimes use Pages and Keynote, both of which have nice UX, but the niceties don't strike me as particularly OS-integrated.

As I mentioned above, everything that makes it harder for developers to add macOS to their list of targets encourages them to not port their app to my current OS of choice. I'm thinking of, well, many in the list above, including games.

This is, I imagine, part of the reason why so many developers left single-platform development for web development. At least, that's my reaction.

Re:Network.framework: A modern alternative to sockets by jexah on Saturday June 09, 2018 @11:28AM (#17273481)
> This is, I imagine, part of the reason why so many developers left single-platform development for web development. At least, that's my reaction.

Spot on. You even gave an example of this: VSCode. If Microsoft is doing it, you can bet loads of other people are.

Re:Network.framework: A modern alternative to sockets by saagarjha on Saturday June 09, 2018 @04:00AM (#17272032)
> I sometimes use Pages and Keynote, both of which have nice UX, but the niceties don't strike me as particularly OS-integrated.

Well, what are the niceties you see? I'd generally say that Pages and Keynote's integration with macOS is one of their strengths.

Re:Network.framework: A modern alternative to sockets by kitsunesoba on Friday June 08, 2018 @11:57AM (#17266688)
Yes precisely. I’m sure this varies from person to person but the applications that have the most staying power in my tool belt by far are those that are well executed first class citizens of my platform of choice. Cross platform apps written by developers who are more concerned with an easy one size fits all solution nearly always fall to the wayside.

I chose the platform I use for a reason. Why should I be ok with apps that undermine that by taking the lowest common denominator approach to porting?

Re:Network.framework: A modern alternative to sockets by falcolas on Friday June 08, 2018 @12:26PM (#17267001)
Interesting. As a counterpoint, if I look at the toolkit I'm using right now on my MacBook, it's:

Chrome

Firefox

Hipchat

Vim

Git

So, not one single-platform tool in the bunch. I'd even go so far to say that, aside from my terminal emulator and app install tool, I don't use any single-platform tools in my day to day job.

> Why should I be ok with apps that undermine that by taking the lowest common denominator approach to porting?

Because they're, in many cases, as good if not better than the native-only alternatives?

Re:Network.framework: A modern alternative to sockets by kitsunesoba on Friday June 08, 2018 @12:56PM (#17267353)
I guess it depends on what types of apps one tends to use and what work you do. While I make frequent use of the terminal, I live in UI apps all day, so bad ports tend to stick out more prominently. If I lived in vim or emacs I could see it not mattering as much.
Re:Network.framework: A modern alternative to sockets by jose_zap on Friday June 08, 2018 @02:26PM (#17268356)
Do you use iTerm for opening vim?
Re:Network.framework: A modern alternative to sockets by jexah on Saturday June 09, 2018 @11:31AM (#17273496)
Clutching at straws.
Re:Network.framework: A modern alternative to sockets by dmitrygr on Friday June 08, 2018 @01:57PM (#17268019)
Which of the apis provided by the socket layer do you find to be unsafe?
Re:Network.framework: A modern alternative to sockets by pjmlp on Friday June 08, 2018 @04:11PM (#17269282)
All that require manually keeping track of pointers, structure and buffer sizes.
Re:Network.framework: A modern alternative to sockets by saagarjha on Saturday June 09, 2018 @04:01AM (#17272036)
That's why you have wrappers in the language of your choice that will handle this for you.
Re:Network.framework: A modern alternative to sockets by geodel on Friday June 08, 2018 @12:06PM (#17266789)
I agree. I extend same to other software like databases etc. I have seen so many project over abstract and that turns out useless when migrating or supporting additional backend with same abstracted solution.
Re:Network.framework: A modern alternative to sockets by brobdingnagians on Friday June 08, 2018 @01:00PM (#17267399)
The people who tend to care about high performance on a specific platform are game developers, and we all know Macs don't have that market. And with deprecating OpenGL, they probably aren't going to be getting it either. People on web are always saying performance of language doesn't matter, but then when these ultra-specific libraries come up it becomes different--- but I'd say server performance is _way_ more important than how fast my Notepad app runs...
Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @01:28PM (#17267727)
Well, also web browser developers, authors of A/V software, etc.

Do you want Safari to be the only web browser on macOS, Quicktime to be the only video player, etc? Not saying that it will happen, but with the disappearance of OpenGL and if sockets eventually disappear, too, it will become more difficult for independent web browsers (e.g. Firefox, Servo), independent video players (e.g. VLC, MPlayer), etc. to create or maintain a macOS version.

Re:Network.framework: A modern alternative to sockets by ovao on Friday June 08, 2018 @03:34PM (#17268968)
While there’s truth to this, there’s no real discussion here about deprecating or removing BSD sockets. UNIX, POSIX and OpenGL are very, very different things to discuss, and Apple deprecating one doesn’t speak to any real expectation of deprecating anything else.

At some point it may happen, but there’s simply no writing on the wall for it right now.

Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @04:54PM (#17269599)
Fair enough.

But I'll remain at least a bit worried, if you don't mind :)

Re:Network.framework: A modern alternative to sockets by jrs95 on Friday June 08, 2018 @01:16PM (#17267587)
OpenCL didn't seem to be succeeding, so that's not entirely surprising. It is disappointing that they've chosen to deprecate OpenGL and ignore Vulcan in favor of Metal, though. Although I don't know much about this particular area, and I couldn't tell you about the merits of Vulcan vs Metal. It's hard to tell whether there's any good technical reasons for their decisions or if it's purely just business in that they don't want to contribute their resources to something that will benefit Android.
Re:Network.framework: A modern alternative to sockets by doctorsher on Friday June 08, 2018 @01:25PM (#17267698)
Admittedly, I am also not well versed in this area. My guess is, because Metal is proprietary, they can include intimate details of their hardware platform to squeeze out the most performance. And they probably would not feel comfortable having that same level of detail in Vulcan.
Re:Network.framework: A modern alternative to sockets by MBCook on Friday June 08, 2018 @03:23PM (#17268863)
They also started making/using (and deploying?) Metal before Vulkan was announced/available.

Doesn’t mean they couldn’t have changed course, but I’m sure it was a factor.

Re:Network.framework: A modern alternative to sockets by ovao on Friday June 08, 2018 @03:39PM (#17269010)
And they may still yet change course. At this point it’s hard to say.
Re:Network.framework: A modern alternative to sockets by vesinisa on Friday June 08, 2018 @11:22AM (#17266325)
> Not everyone cares about cross-platform, some developers rather specialize in a given platform.

Yeah. This is exactly what people thought in the early 2000s of IE6. It was the de facto 'standard' web browser. Whole enterprises were built on the assumption that no other browser matters.

But the world around changed. IE6 became obsolete. Then insecure. People kept running it to use the old apps that would not work on modern browsers. But eventually, IE6 had to be buried.

Thousands of apps containing billions of lines of code had to be re-written at an astronomical cost. Just because, for a short while, we once thought specializing on one platform was a sustainable long-term strategy.

Re:Network.framework: A modern alternative to sockets by ksk on Friday June 08, 2018 @11:58AM (#17266696)
You are claiming a false dichotomy. Specialization doesn't mean future-deprecation. Every single cross-platform app is written to an abstraction. There is no implicit assumption that all abstractions are good. Whenever I hear cross-platform code I think slow bloated web-apps or slow bloated java apps with a funky UI.

Websites written for IE6 can still be used today with minor changes. The problem is activex and other crappy plugin technologies. If people had just targeted Win32, those apps would still be working today - but probably still end up requiring a rewrite because of modern security requirements.

Re:Network.framework: A modern alternative to sockets by pjmlp on Friday June 08, 2018 @11:28AM (#17266382)
Which is why those devs now specialize in Chrome instead.
Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @12:32PM (#17267078)
Sad but largely true.

On the other hand, it is easier to install Chrome on your machine, if you need a Chrome-locked webapp, than to install macOS on the same machine. In fact, the only platform on which you cannot install a Chromium-based Chrome is iOS, and that's a political choice by Apple.

edit Rephrased entirely.

Re:Network.framework: A modern alternative to sockets by dwaite on Saturday June 09, 2018 @01:42AM (#17271715)
Blocking all third party code (and most first party code) from creating executable pages is a pretty strong security decision, but yes it has political ramifications.
Re:Network.framework: A modern alternative to sockets by api on Friday June 08, 2018 @01:58PM (#17268027)
You can also code in a language with good cross platform network APIs like Go or use a wrapper library like boost::asio or libuv. The latter are likely to add support for this eventually if there is a strong benefit to doing so on MacOS.

I'm ambivalent about platform-specific solutions but I welcome any attempt to obsolete socket() and select()/poll() and friends. I absolutely loathe that API.

Re:Network.framework: A modern alternative to sockets by xHopen on Friday June 08, 2018 @03:12PM (#17268753)
I couldn‘t care less about cross Platform honestly, and yeah the most of the mobile market use Andoird, well, the android user (average) don‘t download apps, do not spend money in apps, so... is out of my target.
Re:Network.framework: A modern alternative to sockets by jexah on Saturday June 09, 2018 @11:37AM (#17273517)
Wot. Citation needed? I may not be an "android user (average)" but I download apps every day (paid and free) and have spent far more money than I'd like to admit on the Play Store.
Re:Network.framework: A modern alternative to sockets by trothamel on Friday June 08, 2018 @10:42AM (#17265864)
And I'm now wondering how long it'll be until Apple deprecates Sockets.
Re:Network.framework: A modern alternative to sockets by zamalek on Friday June 08, 2018 @01:31PM (#17267752)
> yet another manner in which my next application won't be cross-platform

I skimmed the video and it really looks like sockets++: once you have the connection the rest is up to you. It doesn't seem to break anything on the wire. Unless you're referring to compilation - but we can assume that Libuv will soon abstract this platform away (just like it does with Windows IOCP).

Re:Network.framework: A modern alternative to sockets by s73v3r_ on Friday June 08, 2018 @12:37PM (#17267136)
If you're writing it in Swift, you're probably doing native apps anyway. So there isn't much reason to not use the native things the platform provides.
Re:Network.framework: A modern alternative to sockets by coldcode on Friday June 08, 2018 @01:49PM (#17267926)
At our company (in one of the largest companies in the US) all of our employee related tools are iOS devices. So cross platform is unnecessary. It's not like we standardized on Palm or Windows Phone, Apple is not going anywhere and neither are we.
Re:Network.framework: A modern alternative to sockets by Yoric on Friday June 08, 2018 @04:57PM (#17269625)
Well, Apple has demonstrated more than once that they are willing to U-Turn and entirely drop core technologies. By opposition, Linuxen and Microsoft try very hard to avoid breaking applications.

So, while Apple is not going anywhere, whichever technologies you're using to build your iOS apps might.

Re:Network.framework: A modern alternative to sockets by orbitur on Saturday June 09, 2018 @02:03PM (#17274160)
Apple hasn't given any examples of removing APIs without a deprecation lasting at least a few years... on iOS.

If it's deprecated on macOS, it's going to be around for a lot longer. They can certainly make things hellish for users trying to install your kext, but the APIs will still be there.

Re:Network.framework: A modern alternative to sockets by pram on Friday June 08, 2018 @10:22PM (#17271162)
Microsoft intentionally broke compatibility with every major release of Windows Phone though, and then ultimately killed the entire platform?
Re:Network.framework: A modern alternative to sockets by Yoric on Saturday June 09, 2018 @02:35AM (#17271839)
Ah? I wasn't aware of that. Still, that doesn't mean that Apple won't :)
Re:Network.framework: A modern alternative to sockets by saagarjha on Saturday June 09, 2018 @04:03AM (#17272041)
Kill the entire platform?