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
2
votes
1 answer

CFSocket data callbacks

In an iPhone app, I create a CFSocket object from an existing native UDP socket and set up a data callback whenever the socket receives some data. I then add that to my main program loop: //Set socket descriptor field cbData.s =…
Manelion
  • 167
  • 9
2
votes
1 answer

How do I handle CFSocketCallBackType.dataCallback in Swift?

All documentation and examples say that if a socket's CFSocketCallBack callout is given a .dataCallback as its second parameter (callbackType), that implies that the fourth one (data) can be cast to a CFData object containing all the data pre-read…
Ky -
  • 30,724
  • 51
  • 192
  • 308
2
votes
1 answer

What does the hasSpaceAvailable property on NSOutputStream mean?

I'm trying to wrap my head around the logic behind hasSpaceAvailable on NSOutputStream. In my app, I'm sending large amounts of data (100MB) broken up into 4080byte chunks (hard limit) over a CFSocket managed by NSInput/output streams. When I start…
ecnepsnai
  • 1,882
  • 4
  • 28
  • 56
2
votes
0 answers

iOS CFSocket crash on empty UDP packet

I am using a CFSocket configured for UDP to send data through wifi. The problem is that when I receive an empty UDP packet, the wifi suddenly stops working. I cant receive or send wnything anymore after that. Does anyone know what seems to be the…
Snacks
  • 513
  • 4
  • 22
2
votes
1 answer

Converting CFSocket context to pointer

I set the context to the address of the class that created the socket like this: CFSocketContext ctxt = {0, (__bridge void *)(self), NULL, NULL, NULL}; self.sock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP,…
2
votes
1 answer

SSL and NSStream

I tried to use SSL in NSStream over CFSocket connection. So I write this code: [self.input setProperty:NSStreamSocketSecurityLevelTLSv1 forKey:NSStreamSocketSecurityLevelKey]; [self.output setProperty:NSStreamSocketSecurityLevelTLSv1…
user2251650
  • 159
  • 1
  • 6
2
votes
2 answers

Issues with MonoTouch and CFStream API

I am currently developing an application that needs to communicate with a MQTT server via a socket connection. As the System.Net.Sockets API tends to misbehave when switching from a WiFi network to a 3G network (and this happens quite a lot…
AlexB
  • 726
  • 4
  • 13
1
vote
1 answer

Binding/Listening to a port in Mac OSX Lion 10.7.2 fails

I am trying to set up a SilverLight policy server under MacOSX 10.7.2 (Lion). This requires that I create and bind a socket to port 943, since SilverLight requests the policy file on this port. Unfortunately, it seems I am unable to bind at that…
Peter Jacobs
  • 1,657
  • 2
  • 13
  • 29
1
vote
1 answer

Not getting data callbacks in iOS UDP socket

I'm trying to set up a UDP socket on iOS to listen for datagrams coming over a multicast socket: #import #include #include #include void getSocketDataCallBack…
Manelion
  • 167
  • 9
1
vote
1 answer

Establishing IPV6 socket connection using CFStreamCreatePairWithSocketToHost

Im facing issue for creating a socket connection with an iPV6 using CFStreamCreatePairWithSocketToHost. But I'm able to create socket connection with IPV4 for the same port number. Tried with all scenarios like adding http, https without http,…
Sumanth
  • 4,913
  • 1
  • 24
  • 39
1
vote
1 answer

How to ensure server-side CFSocket listens after application resigns and returns to active back again?

I have an iOS application that follows roughly the following steps: Opens a listening socket. Accepts a single client connection. Performs data exchanges to/from client. When it receives a "resign active" event, it closes and releases all resources…
dpereira
  • 56
  • 6
1
vote
1 answer

iOS class property not accessible in CFSocketCallback

I have a CFSocket callback method that is declared like this: void socketCallback(CFSocketRef cfSocket, CFSocketCallBackType type, CFDataRef address, const void *data, void *userInfo) { if (_scanningInProgress) { } } And the problem is…
Snacks
  • 513
  • 4
  • 22
1
vote
0 answers

Sth Wrong with the CFSocket on ios server side, the callback function is not be called

I would like to build an online game on iphone , now I need to code to establish an connection between two players, not bonjour , I must use some socket way to do this. And here's my code on the client, It works when running on mac, but not work on…
1
vote
1 answer

iOS Development: Get private IP and port from NSReadStream

I am developing an app for iOS. In my app there is a working TCP-connection to a server, realized via NSStreams. Now I need the port the connection is using which generates some problems. I can get the IP from iterating through the interfaces of the…
Jashugan
  • 323
  • 1
  • 4
  • 17
1
vote
0 answers

My server application is not responding to any requests

I wrote a simple server which responds to http requests. The server is based on CFSocket. Everything works ok when the application runs standalone. But now I rewrote it to a LaunchAgent app. I use XPC to communicate with another process. This…
user2251650
  • 159
  • 1
  • 6