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: Sat, 23 Jul 2011 20:10:33 -0500
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
which contains a lot more debugging output.
What I see in the system.log file from the server is:
Jul 23 20:56:49 Glamdring com.apple.ssd[44366]: server_check_in -
managed2
Jul 23 20:56:49 Glamdring com.apple.ssd[44366]: sockfd: 6
Jul 23 20:56:49 Glamdring com.apple.ssd[44366]: server exit
server_check_in
Jul 23 20:56:49 Glamdring com.apple.ssd[44366]: server - dispatch_main
However, I never see the message:
"DISPATCH_SOURCE_TYPE_READ A"
which should be generated whenever the server receives some data via a
DISPATCH_SOURCE_TYPE_READ event.
What is the best way to debug something like this?
Is there a way to watch the launchd event stream and filter based on
port #?
I did use wireshark and I believe I see the data being sent from the
client to the server...but, of course, I don't see anything being sent
back in return.
Any help or advice would be appreciated.
Oh, since we both agreed that server_read is wonky in the original
implementation, and, in case anyone else is interested, this is what I
changed it to:
bool server_read(int fd, unsigned char *buff, size_t buff_sz, size_t
*total)
{
CFShow( CFSTR( "server_read" ) );
bool result = false;
struct ss_msg_s *msg = (struct ss_msg_s *)buff;
unsigned char* track_buff = buff + *total;
size_t track_sz = buff_sz - *total;
ssize_t nbytes = read(fd, track_buff, track_sz);
printf( "nbytes: %ld\n", nbytes );
printf( "sizeof(struct ss_msg_s): %ld\n", sizeof(struct ss_msg_s)
);
printf( "totalA: %ld\n", *total );
if ( nbytes != -1 )
{
*total += nbytes;
printf( "totalB: %ld\n", *total );
if ( *total >= sizeof( struct ss_msg_s ) )
{
msg->_len = OSSwapLittleToHostInt32(msg->_len);
printf( "msg->_len: %u\n", msg->_len );
if (msg->_len == (*total - sizeof(struct ss_msg_s)))
{
result = true;
}
}
}
return result;
}
which looks correct to me....but, of course, this function never gets
called, so I can't really test it yet.
One other question I had is where can I find documentation on the
launch_xxx (e.x. launch_data_get_fd) function calls? Search for
launch_data_get_fd in the xcode documentation only turns up two results
in sample code projects, but no actual documentation.
p.s. the output from the client is:
Client
/Users/ericgorr/depot/ssd/test.plist
<CFBasicHash 0x100108ad0 [0x7fff7081eee0]>{type = mutable dict, count =
1,
entries =>
9 : <CFString 0x100106180 [0x7fff7081eee0]>{contents = "MyProperty"} =
<CFString 0x100108ab0 [0x7fff7081eee0]>{contents = "Hello, World!"}
}
Client Connected
client_send_request
<CFData 0x1001063e0 [0x7fff7081eee0]>{length = 71, capacity = 71, bytes
= 0x62706c6973743030d101025a4d795072 ... 0000000000000024}
Client request sent...waiting for data...
so, as best I can tell, the data is being sent...as far as the client
is concerned at least....
Thank you.
_______________________________________________
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