Re: Trouble getting SSD Project working & Questions
Re: Trouble getting SSD Project working & Questions
- Subject: Re: Trouble getting SSD Project working & Questions
- From: email@hidden
- Date: Sun, 24 Jul 2011 13:48:13 -0500
On Sat, 23 Jul 2011 20:10:33 -0500, email@hidden wrote:
On Mon, 18 Jul 2011 12:09:19 +0100, Quinn "The Eskimo!" wrote:
On 16 Jul 2011, at 18:06, email@hidden wrote:
2.
The client enters the code where it is waiting for the reply and
then just hangs there. I have some printf statements in the server
code, but they do not appear in any log files, so I am not sure if it
is actually running or not.
[...]
Any idea on why the server may not be running?
Well, it sounds like you're having installation problems, so that's
the first thing I'd look at. After that, look at my comments below.
Looks like a distraction got the better of me. I though I had solved
my installation issue when I saw the server spitting back some
debugging output, but apparently it still isn't working. It never
sees
that it has received any data at all.
I've got an updated project at:
http://ericgorr.net/pq/ssd.zip
Well, I have been able to get it up an running, although, I am not sure
I fully understand why or how to control it.
The server_check_in function contains the following code:
/* This is the IPv6 socket, and it is always located at index 0.
For this
* example, we're going to just ignore it.
*/
launch_data_t sockv6 = launch_data_array_get_index(sarr, 0);
assert(sockv6 != NULL);
assert(launch_data_get_type(sockv6) == LAUNCH_DATA_FD);
/* This is the IPv4 socket. This is the one we're going to
accept(2)
* connections on.
*/
launch_data_t sockv4 = launch_data_array_get_index(sarr, 1);
assert(sockv4 != NULL);
assert(launch_data_get_type(sockv4) == LAUNCH_DATA_FD);
sockfd = launch_data_get_fd(sockv4);
assert(sockfd != -1);
/* We don't need this, so close it. */
(void)close(launch_data_get_fd(sockv6));
I could see the server being launched based on the debugging output and
I also changed the function that the timer calls to print some debugging
output and then call exit(0). Then, I could see that the timer was
firing and exiting the server.
I could then see the server restarting. Based on what I know about
launchd, I knew that launchd would do this if there was data waiting for
the server to process.
So, the question became where was that data?
The comments in the sample code seemed to indicate that it would only
appear over sockv4, but when I swapped what it was doing with sockv6 &
sockv4 so it would connect to the sockv6 socket, I got the round trip
data transfer and the server exited normally.
Why did this happen contrary to the comments?
How can one know on which socket the data will be on?
How can this kind of behavior be controlled? Is there a way to
guarantee that the data would only be delivered to the sockv4 socket? I
noticed the client code just specifies the port...is there something on
the client end that can be done?
What techniques can be used to debug launchd launched servers? Is there
a technique I could have used to see that the data was waiting on the
sockv6 socket?
_______________________________________________
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