Skip to content

Added support for unix domain sockets #88

merged 13 commits into from Aug 25, 2015

6 participants

jdiehl commented Oct 6, 2012

Feature request #76. This is only implemented for GCDAsyncSocket.

Xcode/DomainTest/ demonstrates the use of unix domain sockets as a server and a client.

I tried to implement this feature with as little overall changes to the code as possible, which has yielded some additional code replication.

patr1ck commented Apr 25, 2013

Hey this would be pretty great.


@jdiehl does your fork work smoothly for Unix sockets? I'd like to use it as a drop-in replacement for @robbiehanson's version of CocoaAsyncSocket in Zephyros since I really have no idea how to do Unix sockets myself, and don't have the time to learn them yet.

jdiehl commented Aug 21, 2013

@sdegutis the point of the fork was to integrate unix sockets into CocoaAsyncSocket and the example projects demonstrate how to use them. If they cover what you need you should be fine. If you run into any issues, let me know and I will be happy to take a look at it.


@jdiehl great, sounds like just what I need. Thanks :)

jdiehl commented Aug 25, 2013

I updated the branch to work with the latest master, so it is ready to be pulled (or used otherwise) again :)


@jdiehl great! By the way I'm using your (and @robbiehanson's) code in Zephyros and it's working perfectly, thanks!

jdiehl commented Apr 16, 2014

The email still made it ;)

trojanfoe and others added some commits May 6, 2014
@trojanfoe trojanfoe Use [NSURL fileURLWithPath] as [NSURL URLWithString] breaks if the pa…
…th contains a space.

Using a path containing a space will cause the returned URL to be nil which will stop the
socket:didConnectToUrl: delegate method from being called, which will lead to a breakdown
in the connection sequence.  This took me a while to find.
@trojanfoe trojanfoe Initialize variable to silence compiler warning. cda96dd
@jdiehl jdiehl Merge pull request #1 from trojanfoe/socketUN_space_fix
Fix when the UNIX Socket path contains a space
swt2c commented Jan 27, 2015

@jdiehl Thanks for the unix domain socket support!

I ran into one small bug that was rather tricky to track down (it resulted in connections being accepted on sockets that were closed). In closeWithError:, this line:
if (!accept4Source && !accept6Source && !readSource && !writeSource)
should also include && !acceptUNSource

jdiehl commented Jan 29, 2015

@swt2c Good catch! I have updated my fork


@jdiehl Can you rebase your PR against the latest master?

@jdiehl jdiehl Merge branch 'master' into socketUN
jdiehl commented Aug 22, 2015

Thanks for finally finding the the time to consider this. I have updated the pull request.


@jdiehl Two small things, would you mind squashing your commits and adding a very basic XCUnit test to Tests/CocoaAsyncSocket.xcworkspace based on the DomainTest example?

Looks awesome, thank you!


@jdiehl Thanks! This looks great!

@chrisballinger chrisballinger merged commit 317d5a1 into robbiehanson:master Aug 25, 2015

1 check passed

Details continuous-integration/travis-ci/pr The Travis CI build passed
@jdiehl jdiehl deleted the unknown repository branch Aug 25, 2015
jdiehl commented Aug 25, 2015

No problem. In case you haven't noticed - I also extended your generic test cases to verify that actual data transfer worked (I needed this for the unix domain socket tests anyways).


@jdiehl Ya great work! Those 'tests' were more of a placeholder so thank you for fixing that up :)


@jdiehl Would you mind submitting another PR to fix this failing Travis test? Dunno why this wasn't caught by the tests for the PR itself

jdiehl commented Aug 25, 2015

The Travis website never seems to finish loading and is not reporting any useful errors for me... Do you see anything?

jdiehl commented Aug 26, 2015

See #337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.