Re: Apple modern client/server paradigm
Re: Apple modern client/server paradigm
- Subject: Re: Apple modern client/server paradigm
- From: Howard Shere <email@hidden>
- Date: Mon, 06 Aug 2018 13:45:16 +0000
- Thread-topic: Apple modern client/server paradigm
I have worked with two solutions on macOS/iOS for a web server built into my
applications.
On iOS I have used CocoaHTTPServer
https://github.com/robbiehanson/CocoaHTTPServer/tree/master/Samples/SimpleHTTPServer
and on macOS I used this:
https://github.com/cesanta/mongoose
Both would work on macOS, the advantage of CocoaHTTPServer is the structure, it
is really easy to subclass to handle different URLs, pretty easy to use.
Mongoose is C code, normal socket stuff.
On Aug 3, 2018, at 7:01 PM, Jens Alfke
<email@hidden<mailto:email@hidden>> wrote:
On Aug 3, 2018, at 4:37 PM, Carl Hoefs
<email@hidden<mailto:email@hidden>> wrote:
- Does one use Apache on macOS and place binaries into CGI-Executables? Or use
something like CocoaHTTPServer to create a custom server? Or...?
I don't think Apache is even present anymore; there's no "Web Sharing" checkbox
in the Sharing system pref.
Building a server component is nontrivial, unfortunately. The actual socket
part is pretty easy if you use NSNetService and publish your service with the
NSNetServiceListenForConnections option — you just have to add a delegate
method that will be called with an NSStream input/output pair when a client
connects.
But once you've got the socket streams, the OS doesn't help you with
implementing any protocols. Implementing a real working HTTP server is pretty
hard, but it's probably a lot easier to implement a dumbass one that just
responds to one request and closes the socket (i.e. HTTP/0.9.) You can use
CFHTTPMessage to do the header parsing/generation.
- On the iOS side, does one need only use NSURLConnection and friends? Or...?
It's NSURLSession these days.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list
(email@hidden<mailto:email@hidden>)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
Howard Shere | Software Sculptor
Desk: +1 CAL.LMO.BILE | Mobile: +1 901.359.4200
email@hidden<mailto:email@hidden>
www.synchronoss.com<http://www.synchronoss.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden