Socket stream not providing data
Socket stream not providing data
- Subject: Socket stream not providing data
- From: David Sinclair <email@hidden>
- Date: Thu, 13 Apr 2006 15:10:21 -0700
Hi. I am implementing a server and client based on the Echo and Echo
Client sample code for socket stream networking.
When I use my server and the Echo Client demo, the sockets are
connecting fine, the read and write stream callbacks get the open
messages, but the read callback on the server never receives a bytes
available message, even after the client has successfully written
data. Polling CFReadStreamHasBytesAvailable() always returns false.
If I try to write data from my server, CFWriteStreamCanAcceptBytes()
always returns false, and if I try writing regardless,
CFWriteStreamWrite() always blocks and times out with -1, even when
the client is polling for data to read. The callback then gets the
error message.
I had similar issues using my client and the Echo demo server.
Are there any circumstances than can cause this situation? Is there
a fix?
I found someone else who had what sounds like the same issue in the
archives:
<http://lists.apple.com/archives/macnetworkprog/2004/Feb/msg00127.html>
I tried nestat, which indicated the correct number of bytes in the
receive queue thusly (I'm running both server and client on the same
machine while testing):
% netstat
Active Internet connections
Proto Recv-Q Send-Q Local Address Foreign Address
(state)
tcp4 24 0 10.0.1.4.58282 10.0.1.4.58343
ESTABLISHED
tcp4 0 0 10.0.1.4.58343 10.0.1.4.58282
ESTABLISHED
[snip]
That thread also suggested to "perform a select on the socket and see
if it succeeds" but I don't know what that means?
--
David Sinclair, Dejal Systems, LLC - email@hidden
Custom Mac OS X development - http://www.dejal.com/consulting/
Site change and failure monitor tool - http://www.dejal.com/simon/
Plus other useful Mac products - http://www.dejal.com/
_______________________________________________
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