Questions tagged [gcdasyncsocket]

GCDAsyncSocket is a TCP socket library built upon Grand Central Dispatch. The project also contains a !RunLoop based version, as well as UDP socket libraries.

GCDAsyncSocket and AsyncSocket are TCP/IP socket networking libraries. Here are the key features available in both:

Native objective-c, fully self-contained in one class. No need to muck around with sockets or streams. This class handles everything for you. Full delegate support Errors, connections, read completions, write completions, progress, and disconnections all result in a call to your delegate method. Queued non-blocking reads and writes, with optional timeouts. You tell it what to read or write, and it handles everything for you. Queueing, buffering, and searching for termination sequences within the stream - all handled for you automatically. Automatic socket acceptance. Spin up a server socket, tell it to accept connections, and it will call you with new instances of itself for each connection. Support for TCP streams over IPv4 and IPv6. Automatically connect to IPv4 or IPv6 hosts. Automatically accept incoming connections over both IPv4 and IPv6 with a single instance of this class. No more worrying about multiple sockets. Support for TLS / SSL Secure your socket with ease using just a single method call. Available for both client and server sockets. GCDAsyncSocket is built atop Grand Central Dispatch:

Fully GCD based and Thread-Safe It runs entirely within its own GCD dispatch_queue, and is completely thread-safe. Further, the delegate methods are all invoked asynchronously onto a dispatch_queue of your choosing. This means parallel operation of your socket code, and your delegate/processing code. The Latest Technology & Performance Optimizations Internally the library takes advantage of technologies such as kqueue's to limit system calls and optimize buffer allocations. In other words, peak performance. AsyncSocket wraps CFSocket and CFStream:

Fully Run-loop based Use it on the main thread or a worker thread. It plugs into the NSRunLoop with configurable modes.

For more information follow these links:

  1. https://github.com/robbiehanson/CocoaAsyncSocket
  2. https://github.com/darkseed/cocoaasyncsocket/wiki/Reference_GCDAsyncSocket
204 questions
2
votes
1 answer

GCDAsyncSocket freezes UI when receiving data

I'm new to GCD principles and GCDAsyncSocket, but I'm using it in my project. I initialize the GCD socket in the AppDelegate with: self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; Now, everything…
raj
  • 187
  • 1
  • 11
2
votes
0 answers

Can I read / send data with GCDAsyncSocket when my app is in background?

I've use GCDAsyncSocket to implement telnet protocol parser. Recently, I found that if the app enter background, it will be no longer able to read or write data any more. I've enabled background function of GCDAsyncSocket: __weak typeof(self)…
Hubert Wang
  • 502
  • 5
  • 17
2
votes
1 answer

GCDAsyncSocket on browser connects and disconnects immediately with "Socket closed by remote peer" error

I am really new to Network programming and using GCDAsyncSocket for the first time. I am trying to implement an iOS app where 1 device acts a host and other devices(browsers) connect to it. I am using NSNetService/NSNetServiceBrowser for…
Vik Singh
  • 1,563
  • 2
  • 19
  • 36
2
votes
0 answers

iOS: Creating a server socket for mutual SSL authentication using GCDAsyncSocket

I'm pulling my hair out on this one and would greatly appreciate some assistance. Unfortunately my experience with SSL is quite limited so I don't know where I'm going wrong. I need to develop an iOS app that acts as an server with mutual SSL…
Stephen Asherson
  • 1,557
  • 14
  • 23
2
votes
0 answers

Is there a GCDASyncSocket version or something that mimics it for the Android?

My IOS App uses GCDASyncSocket, but now I need to develop it for the android! I can develop everything else with ease, but since I am using GCDASyncSocket in my IOS App, making it for Android without GCDASyncSocket or something identical to it for…
JasonH
  • 93
  • 8
2
votes
1 answer

Playing voice from server stream of nsdata using AudioUnit IOS

I am trying to build some kind of VoIP application in iOS. So far I have been able to successfully send the microphone data as a buffer from microphone to the server using GCDAsyncSocket. Now I need to play back the data I receive, which I am really…
dynebuddha
  • 471
  • 4
  • 9
2
votes
1 answer

Swift using Objective-C class

I am trying to use GCDAsyncSocket to connect my app. I get compilation errors. When I try this: class Connection : NSObject { var connected: Bool var tcpSocket: GCDAsyncSocket? var myHost: String = "127.0.0.1" var myPort:…
2
votes
0 answers

Handshake GCDAsyncSocket

I use in my iPhone app the GCDAsyncSocket class to communicate with a Java server. It works well without SSL. Does anybody knows how to activate SSL with self signed certificates? I can't find how I can import my certificate in the code. Please…
2
votes
0 answers

GCDAsyncSocket "didReadDataWithTag" Never called with NSOperation subclass

In a "getMyFile" method of some XIB file. I am creating a object of class "A"(subclass of NSOperation) and adding it to a "myFileQueue"(object of NSOperationQueue). myFileQueue.MaxConcurrentOperationCount = 1; Problem : didReadDataWithTag" delegate…
2
votes
1 answer

GCDAsyncUdpSocket cannot bind port on iOS simulator

I'm working on sending message through UDP. However, I've been trapped in the problem about 'binding port'. When I built the project on iOS simulator first time, nothing strange happened. Everything was fine. But when I built the project second…
BuG.BS
  • 95
  • 1
  • 8
2
votes
2 answers

Synchronous communication using GCDAsyncSocket

I am using GCDAsyncSocket (CocoaAsyncSocket) for the socket communication in my app. Due to the asynchronous nature of GCDAsyncSocket, my network request (submitMessage below) is decoupled from the callback block that runs when data is received…
2
votes
0 answers

Trying to use GCDAsyncSocket for buffered transfer

(UPDATED) I am trying to read a large file ( a video or a picture) and send it to a remote server via a SOAP request. I need to encode the data as a Base64 string. I am trying to do this as follows: Create a template xml for the SOAP request that…
PeterD
  • 642
  • 1
  • 6
  • 17
2
votes
1 answer

Issue Connecting with GCDAsyncSocket with OSX executable

I have the excellent GCDAsyncSocket running perfectly on an iOS app I have developed. I was just playing around with setting up a Mac OSX command line program that uses the library in a similar way to log to SQLite DB but can't get it to even…
Andy
  • 717
  • 1
  • 9
  • 24
2
votes
1 answer

GCDAsyncUDPSocket source address returns null

google code question mirror: https://groups.google.com/forum/#!topic/cocoaasyncsocket/grhjZSMLr3U here is my code that is reading the response: - (void)init { udpSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self…
stackOverFlew
  • 1,479
  • 2
  • 31
  • 58
2
votes
1 answer

didConnectToHost isn't getting called

I've made a client with a class named "NetClass" using GCDAsyncSocket and importing CGDAsyncSocket.h. Than in my LoginViewController I've called my net class function to connect to the server. On the server side I see that client is connected,…