Questions tagged [cfsocket]

Sockets are the most basic level of network communications. A socket acts in a similar manner to a telephone jack. It allows you to connect to another socket (either locally or over a network) and send data to that socket.

43 questions
8
votes
1 answer

IOS receiving data timeout CFsocket

I want to connect with pool.ntp.org to time sync. So am creating a socket sock=CFSocketCreate(NULL, PF_INET, SOCK_DGRAM, IPPROTO_UDP, kCFSocketDataCallBack|kCFSocketWriteCallBack|kCFSocketConnectCallBack, sockCallback, &sock_ctx); then am…
tspentzas
  • 178
  • 1
  • 10
6
votes
2 answers

UDP broadcast using CFSocket on IOS

Have been doing some google search and some reading on this subject but cannot seem to get it right no matter how much time i spent searching. What i want to do is to receive broadcast message of devices that are connected on my network by…
Alyek
  • 135
  • 1
  • 11
5
votes
0 answers

CFSocket accept callback is not being called. What have I missed?

I'm currently writing a simple TCP server class in Objective-C which should be able to bind to and listen on a particular port. I particular I have a function -(void) start which creates a CFSockets, binds it to the port specified and adds it to a…
pb593
  • 91
  • 5
5
votes
2 answers

How to send a string in a UDP socket in iOS7?

I am trying to send a simple string over UDP in my iOS7 app to a known IP and could not find a simple explanation and sample code on how to do that. There is plenty out there about TCP but not so much about UDP and it has to be UDP in my case.
Michal Shatz
  • 1,416
  • 2
  • 20
  • 31
4
votes
2 answers

How to Connect multiple peers on the iPhone Application over WiFi?

I have an idea for an ios(iPhone) application to which requires connecting to several peers. I am basing my code on the WiTab (SampleCode-developer.apple.com) example. When my application started each peer creating separate Socket(CFSocket) and…
Musthafa P P
  • 645
  • 3
  • 7
  • 21
4
votes
2 answers

CFSocketSetAddress fails if not host computer IP?

I am making a simple WOL application. So far I can successfully create a socket, however when setting the address using CFSocketSetAddress I can only use the network ip of my computer (WiFi ip = 192.168.0.5) or local ip (127.0.0.1). For WOL I would…
Alex
  • 587
  • 11
  • 31
4
votes
2 answers

Creating and binding socket on Mac OS Hight Sierra

I have serious and strange problem with creating socket in my application for Hight Sierra. If I create command Line tool, everything is ok! I create socket, bind socket. But If I trying to create Cocoa App, I can't binding my socket! :( If I use…
Ruslan
  • 67
  • 1
  • 6
4
votes
0 answers

how to disable nagle's algorithm in iOS?

I am using cfwritestream to read and write into socket for iOS. i need to disable Nagle's algorithm so as to increase the writing efficiency of the socket and have made changes to include TCP_NODELAY, however, from the pcap logs I dont see that…
scooby
  • 493
  • 11
  • 31
4
votes
1 answer

OS X - Communication between launch daemon and launch agent

I am new to OS X and have to create an application having 2 parts - launch daemon and launch agent. The daemon is going to do stuff such as command execution, logging, etc and has to somehow communicate these results to launch agent (which would…
Sagar Natekar
  • 231
  • 3
  • 11
3
votes
0 answers

How to enable keep alive in ios CFSocket?

How can i enable keep alive in ios app (CFSocket class).
sps
  • 81
  • 5
3
votes
1 answer

CFSocket in Swift (4)

I try to establish a connection to a TCP server, unfortunately without success. Here is my actual way. Does anyone knows, where the error is? I'm getting the error at CFSocketConnectToAddress (I get the .error result, so my code results in the error…
Lupurus
  • 3,618
  • 2
  • 29
  • 59
3
votes
1 answer

Swift2, Call swift function in CFSocketCallBack - EXEC_BAD_ACCESS

I'm trying to write a socket server app for Mac OSX with Xcode:7.2.1 in Swift2.1.1. referring to CocoaEcho sample code. But I cannot call a swift function in the socketCallBack function. My code is here. I'm passing the self based on the answer at…
JVI
  • 63
  • 6
3
votes
0 answers

CFSocketCreate request is not going via UDP

I have used below code to create socket. CFSocketRef socket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM, IPPROTO_UDP, 0, NULL, NULL); I have given SOCK_DGRAM, IPPROTO_UDP as parameters to go request via UDP, But still request is going…
RXGangam
  • 199
  • 12
3
votes
0 answers

CFSocket data callback

Does anyone know how the CFSocket API reads bytes from the socket into the data callback? I thought at first it would do some "under the hood" work to always return the data in the same length as it was sent but after some testing I found that data…
GenericPtr
  • 677
  • 1
  • 8
  • 18
2
votes
1 answer

alternative for deprecated CFStreamCreatePairWithSocket

The Apple docs mark CFStreamCreatePairWithSocket as deprecated since IOS 15.0. What would be a related successor ? We use CFSocket/NSStream functions currently to have event driven network reads/writes in a runloop.
Leo
  • 925
  • 10
  • 24
1
2 3