Cannot allocate memory error using GCDAsyncSocket

I'm trying to upload videos to a server via TCP/IP using GCDAsyncSocket. Sometimes, the socket disconnects with an error that I haven't been able to eliminate:

2011-12-17 11:39:25.073 Hadza[433:707] socketDidDisconnect, error: Error Domain=NSPOSIXErrorDomain Code=12 "Cannot allocate memory" UserInfo=0x2aa260 {NSLocalizedFailureReason=Error in write() function, NSLocalizedDescription=Cannot allocate memory}

I've been looking everywhere but I can't really see what is the cause of this, how to fix it or workaround this issue.

The flow that the app follows to upload a file is the following:

  1. Write to server (a media_id )
  2. Read an ACK sign from server
  3. Read number of bytes already sent
  4. Write the video from bytes sent to the end
  5. Read waiting for an ACK signal (meaning that the upload was ok)
  6. If everything went OK , finish. If there was an error, restart from 1 or 3 depending on the error.


Need Your Help

Sencha Touch 2: Pass data from a panel to another panel

javascript extjs panel

I was wondering myself, how it is possible to pass data from a panel to another panel? The panel, to which I want to pass the data, is defined in the items-collection of the panel, which holds the ...

Android SDK and Eclipse Virtual device not launching

java android eclipse sdk

I have just installed eclipse with the andriod sdk. I have completed all suggested steps. When I attempt to launch the Emulator widows returns emulator arm stopped working can anyone help me with t...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.