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

How to know whether this is the last packet sent from a bulletin board system

I am writing a bulletin board system (BBS) reader on ios. I use GCDAsyncSocket library to handle packets sending and receiving. The issue that I have is the server always splits the data to send into multiple packets. I can see that happens by…
user3739779
  • 183
  • 2
  • 6
0
votes
1 answer

iOS threading not calling a specific function in AdHoc distribution but works when run from xcode

I have a app that works when I run it on my iPad from xcode, but when I prepare it for AdHoc distribution, it will not function correctly. My thread is: [NSThread detachNewThreadSelector:@selector(wifiBackground) toTarget:self withObject:nil]; The…
0
votes
1 answer

Hosting secured connection with iOS device

I'm working on a file share application. It's working with TCP connection between two iOS devices and I need secured connection between them. I'm using GCDAsyncSocket library for connection. I used this library for connecting other applications that…
Boran
  • 949
  • 10
  • 17
0
votes
1 answer

Threading issue with CocoaAsyncSocket and coredata

My app handles socket connection in a background queue. Inside a helper class which will be called from the connection queue, I have to access core data to perform a validation (fetch request). How can I execute the core data fetch in the main…
Clement Prem
  • 3,112
  • 2
  • 23
  • 43
0
votes
1 answer

iOS 6 and continuous receiving udp package using gcdasyncsocket

I have problem with continuous receiving udp package with gcdasyncsocket. It's like iP5 iOS6 and iP4 iOS6 receive package for 200-300 ms then stop for another 200-300 and start receiving again. I run some test with iPhone 5 iOS7, iPhone 4 iOS 6 and…
Błażej
  • 3,617
  • 7
  • 35
  • 62
0
votes
0 answers

Transferring a file through TCP in GCDAsyncSocket

I am currently writing a game in which I intend to transfer a .caf sound file from the iPhone to my C++ server. Right now I am getting an EXC_BAD_ACCESS when I message the sendGameUpdateWithFile function, and I really have no idea why. Although this…
Henrik Hillestad Løvold
  • 1,213
  • 4
  • 20
  • 46
0
votes
1 answer

Cocoaasyncsocket multiple write operations

I have implemented gcdasynsocket in my app and performing multiple write operations. The delegate didWriteDataWithTag is called twice but didreaddata is called only once (ie) for only one write operation. -(void)connectToHost:(NSString*)ip…
Karthick
  • 382
  • 1
  • 3
  • 23
0
votes
0 answers

How to know when GCDAsyncSocket's readStream is done reading indefinite amount of data?

I am making an iPhone app that connects to a server (whose protocol I have no control over) and gets a stream of textual data, where each line ends with a CRLF, and the amount of lines, as well as their exact length, is undetermined. I'm calling…
newenglander
  • 2,019
  • 24
  • 55
0
votes
1 answer

String will not display in UITextView

I can't seem to get a UITextView to display a string, in this case the combined variable. Here is my code: - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag { NSData *pongReply = [@"PONG :hades.arpa\r\n"…
sploit_
  • 11
  • 4
0
votes
1 answer

GCDasyncUdpSocket can't reveive packets after changing from broadcast to unicast mode

Developing an iPAD app which communicates via WiFi to a UDP to serial converter. App starts out in broadcast mode and retrieves a list of responding units (requestPodIds). The received data maps a SN to the units IP address. The selected IP…
0
votes
1 answer

GCDAsyncUdpSocket + Bonjour? (bynamic udp port)

I'm using GCDAsyncUdpSocket for my project, I can bind a port this way, (Server part) [udpSocket bindToPort:45678 error:&error]; But I don't want to give a static port number for this. How to get available free ports for UDP communication ? I am…
Thilina Chamath Hewagama
  • 9,039
  • 3
  • 32
  • 45
0
votes
2 answers

CocoaAsyncSocket / GCDAsyncSocket add a delay between writes on the queue

I have the following function: if (socket==nil) socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()]; if (elBuffer==nil) elBuffer = [[NSMutableData alloc] init]; } if ([socket isDisconnected]) { …
JoeGalind
  • 3,545
  • 2
  • 29
  • 33
0
votes
1 answer

GCDAsyncSocket and send SIP packet

i try to send INVITE to SIP server: GCDAsyncSocket *outgoingCallSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:socketOutgoingCallQueue]; BOOL result = [outgoingCallSocket connectToHost:currentSoftswitch.ip…
user170317
  • 1,152
  • 2
  • 11
  • 22
0
votes
1 answer

How to parse data into an array or dictionary

I have an app that makes multiple connections to different servers at the same time. I want to record each connection in an array so I can display them in a tableview and use them in a different section of my app. This is what I get back from…
0
votes
1 answer

How do I make GCDAsyncSocket that is declared in AppDelegate available to view controllers

Following a post of similar question (which doesn't work), I declared a instance of GCDAsyncSocket on AppDelegate.h #import @class ViewController; @class GCDAsyncSocket; @interface AppDelegate : UIResponder…
Scott
  • 308
  • 4
  • 20
1 2 3
13
14