Comments (6)
I am also getting this. Is this the intended behavior?
Is this library still being maintained?
from objc-zmq.
I had to switch the code to using 0MQ 2 instead of but here's a fix for the nonblocking issue:
If I have time later, I'll package this all up as a PR
Basically, you just need to check for errno=EAGAIN per http://api.zeromq.org/2-1:zmq-recv
#pragma mark Communication
- (NSData *) recv:(ZMQMessageReceiveFlags) flags {
zmq_msg_t data;
int err = zmq_msg_init(&data);
if (err) {
ZMQLogError(self, @"zmq_msg_init");
return nil;
}
errno = 0;
err = zmq_recv(self.socket, &data, flags);
if (err) {
if (flags == ZMQ_NOBLOCK && errno == EAGAIN) {
zmq_msg_close(&data);
return nil;
} else {
ZMQLogError(self, @"zmq_recv");
err = zmq_msg_close(&data);
if (err) {
ZMQLogError(self, @"zmq_msg_close");
}
}
}
size_t length = zmq_msg_size(&data);
NSData *msg = [NSData dataWithBytes:zmq_msg_data(&data) length:length];
err = zmq_msg_close(&data);
if (err) {
ZMQLogError(self, @"zmq_msg_close");
/* fall through */
}
return msg;
}
from objc-zmq.
I just learned objective-c today, but fortunately this library is pretty simple, if poorly documented.
from objc-zmq.
@rmcgibbo you save my day. Thank you.
from objc-zmq.
@rmcgibbo not working when receive data from server
<ZMQSocket: 0x9155cc0 (ctx=0x9153da0, type=ZMQ_XREQ, endpoint=tcp://10.8.8.18:12345, closed=0)>: zmq_recv: Undefined error: 0
from objc-zmq.
Contributions are welcome.
from objc-zmq.
Related Issues (17)
- crash when [socket close] is called more than once HOT 1
- xcodebuild command is wrong in documentation on zeromq.org HOT 1
- objc-zmq Authentication HOT 1
- linker error when we use armv7 in zeromq HOT 2
- Updated for 4.0.5 HOT 2
- How does this work? HOT 1
- ZMQException on setting ZMQ_CURVE_SECRETKEY value on a ZMQSocket HOT 1
- Installing via CocoaPods in an OS X (NOT iOS) project should work out of the box HOT 3
- Can we have a newest ZMQ lib? HOT 1
- Bundled project has DEPLOYMENT_TARGET of 10.9, but podspec targets 10.10+ HOT 3
- objc-zmq background, flash back
- objc-zmq issues using Xcode 10
- Compilation for iOS. HOT 2
- How to use it for iphone HOT 9
- Unable to send request to server HOT 1
- Build universal HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objc-zmq.