gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Modern" server socket programming?


From: David Chisnall
Subject: Re: "Modern" server socket programming?
Date: Tue, 8 Jan 2013 17:00:43 +0000

Hi Marcus,

The easiest way of scheduling a socket in the run loop is to remember that 
sockets are just file descriptors and so can be wrapped in an NSFileHandle and 
connected to a notification.  This is easy from anything that allows you to get 
the underlying file descriptor for the socket, and if it's already encapsulated 
in an object then you can either use associative references or just create an 
NSDictionary indexed by the file handles.

David

On 8 Jan 2013, at 16:55, Marcus Müller wrote:

> Hi all,
> 
> I've just started to port a rather tiny Bonjour-service based server 
> application from OSX to GNUstep (running on FreeBSD 9.1). Because this is a 
> new-school ObjC 2.0 ARC based project, I've also installed all prerequisites 
> for doing that: brand new clang, libobjc2. Everything works as expected (even 
> the Bonjour code), life is good.
> 
> 
> PROBLEM
> =========
> 
> I've then extended the code to provide a Bonjour service. Because it's very 
> convenient to do so on OSX, I've made use of ULINetSocket 
> (uliwitness/ULINetSocket · GitHub). ULINetSocket itself is a very convenient 
> wrapper around CFSocket… and that's where the trouble kicks in. It appears 
> the CFSocket runloop scheduling code hasn't been done, yet, which makes it 
> rather pointless to use GNUstep corebase in conjunction with ULINetSocket 
> right now (* see below).
> 
> I've then started to look into alternatives (including my own ObjC socket 
> code which dates back ~ 10 years), but all of them seem to use background 
> threads (or have issues with IPv6) which seems quite out of date in 2013.
> 
> 
> SOLUTION?
> ==========
> 
> Searching for alternatives I've stumbled across GSSocketServerStream 
> (GSInetServerStream, …) which seems to be something that I could use, but 
> haven't found any code demonstrating how to use it. Does anybody have any 
> demo code/project as a starting point?
> 
> Are there any other modern socket libraries (focus on server socket) that you 
> can recommend? Ideally, something which works on OSX and GNUstep out of the 
> box?
> 
> 
> Cheers,
> 
>   Marcus
> 
> 
> P.S.: (*) I'm aware that I could also go ahead and implement the missing 
> CFSocket runloop scheduling code. While that's probably interesting to do and 
> GNUstep's GSRunLoop already provides most (all?) the required infrastructure 
> for that, the problem that GNUstep corebase isn't ARC compatible would 
> prevent me from using it in my project anyways (and rewriting everything to 
> non-ARC is out of question for me).
> 
> -- 
> Marcus Müller  .  .  .  http://www.mulle-kybernetik.com/znek/
> 
> 
> 
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev

-- Send from my Jacquard Loom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]