• 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
Can't open CFWriteStream
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't open CFWriteStream


  • Subject: Can't open CFWriteStream
  • From: James Walker <email@hidden>
  • Date: Fri, 13 Aug 2010 13:58:55 -0700

I'm trying to set up simple one-way TCP communication between two computers on a LAN. Conceivably my problem could be on either end, but I think the listener is probably OK; it's similar to known working code that listens for UDP, and Netstat indicates that I'm listening for TCP on the right port. Oh, and I checked that the firewall is turned off on that computer.

So, here's the sender code. What happens is that after a minute or so, the callback gets a timeout error. Any idea what could be wrong?

	CFWriteStreamRef	writeStream = NULL;
	CFStreamCreatePairWithSocketToHost( NULL,
		CFSTR("192.168.1.165"), 10552,
		NULL, &writeStream );

	if (writeStream != NULL)
	{
		NSLog(@"Created stream");

		CFStreamClientContext contextRec =
		{
			0, self, NULL, NULL, NULL
		};
		CFWriteStreamSetClient( writeStream,
			kCFStreamEventOpenCompleted |
			kCFStreamEventCanAcceptBytes |
			kCFStreamEventErrorOccurred |
			kCFStreamEventEndEncountered,
			StreamCallBack, &contextRec );

		CFWriteStreamScheduleWithRunLoop(
			writeStream, CFRunLoopGetMain(),
			kCFRunLoopCommonModes );
		

		if (CFWriteStreamOpen( writeStream ))
		{
			NSLog(@"stream open started");
		}
		else
		{
			NSLog(@"CFWriteStreamOpen returned false");
		}
	}

--
  James W. Walker, Innoventive Software LLC
  <http://www.frameforge3d.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


  • Follow-Ups:
    • Re: Can't open CFWriteStream
      • From: James Walker <email@hidden>
  • Prev by Date: Script to create a network
  • Next by Date: Re: Can't open CFWriteStream
  • Previous by thread: Re: Script to create a network
  • Next by thread: Re: Can't open CFWriteStream
  • Index(es):
    • Date
    • Thread