Skip to content

Added support for unix domain sockets #88

Merged
merged 13 commits into from Aug 25, 2015

6 participants

@jdiehl
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
patr1ck commented Apr 25, 2013

Hey this would be pretty great.

@sdegutis

@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
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.

@sdegutis

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

@jdiehl
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 :)

@sdegutis

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

@jdiehl
@trojanfoe
@jdiehl
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.
ce2f9f8
@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
7e97fc8
@swt2c
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
jdiehl commented Jan 29, 2015

@swt2c Good catch! I have updated my fork

@chrisballinger
Collaborator

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

@jdiehl jdiehl Merge branch 'master' into socketUN
Conflicts:
	Source/GCD/GCDAsyncSocket.h
	Source/GCD/GCDAsyncSocket.m
9428ceb
@jdiehl
jdiehl commented Aug 22, 2015

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

@chrisballinger
Collaborator

@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!

@chrisballinger
Collaborator

@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
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).

@chrisballinger
Collaborator

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

@chrisballinger
Collaborator

@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 https://travis-ci.org/robbiehanson/CocoaAsyncSocket/builds/77216073#L564

@jdiehl
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
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.