Using a GCD Client ( was Re: Trouble getting SSD Project working & Questions )
Using a GCD Client ( was Re: Trouble getting SSD Project working & Questions )
- Subject: Using a GCD Client ( was Re: Trouble getting SSD Project working & Questions )
- From: email@hidden
- Date: Mon, 25 Jul 2011 22:25:58 -0500
So, I've got another sample project at:
http://ericgorr.net/pq/AF_UNIX_GCD_Client.zip
In the readme for the SSD sample code, it mentions that the client
should be sending and receiving data to and from the server
asynchronously using GCD. So, that is what I am attempting next, but
using AF_UNIX sockets. However, it isn't working.
In the sample project, the only thing that is going on currently is
that I connect to the server and then close the connection by closing
the file descriptor. The behavior that I am seeing on the server end is
that it believes it has data and just constantly tries to read data that
isn't there. So, clearly, I am not disconnecting from the server
correctly or, perhaps, it is against the rules to connect without doing
anything further.
In the main function, there are also three lines of code commented out:
//assert( client_read_replies( sfd ) );
//assert( client_send_request( sfd, req ) );
//dispatch_main();
They were attempts to see if I could get the reading and writing of
data from and to the server working.
If they are uncommented...
client_read_replies attempts to set up a DISPATCH_SOURCE_TYPE_READ
handler to receive data back from the server. However, even with this
handler installed, it is never called.
client_send_request sets up a DISPATCH_SOURCE_TYPE_WRITE handler. This
appears to work correctly...to a point. As near as I can tell, the data
does get written and I can see the server start to respond, but then
both the client and the server lock up. The server never seems to fully
read the data sent and never tries to send a reply back. I have tried
setting the file descriptor to non-blocking, but that doesn't appear to
help.
dispatch_main simply enters into an event loop. I don't imagine there
is anything wrong with doing this.
I can only imagine the number of things I am doing wrong on the client
side. As always, any advice or suggestions are appreciated.
btw, I have filed a bug report against the SSD project: rdar://9839152
_______________________________________________
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