• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Socket stream not providing data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: .NET Web Services using Cocoa
  • Next by Date: Must you read all you can on kCFStreamEventHasBytesAvailable?
  • Previous by thread: .NET Web Services using Cocoa
  • Next by thread: Must you read all you can on kCFStreamEventHasBytesAvailable?
  • Index(es):
    • Date
    • Thread