I'm trying to use CocoaAsyncSocket library with Swift.
I would like to implement a UDP server and client. I've imported the library and here is one of my methods's implementation:
func setupConnection(){
var error : NSError?
socket = GCDAsyncUdpSocket(delegate: self, delegateQueue: dispatch_get_main_queue())
do {
try socket.bindToPort(PORT, error: &error)
try socket?.connectToHost(IP, onPort: PORT)
try socket.beginReceiving()
} catch _ {
print(error)
}
send("ping")
}
Unfortunatly I got this error on bindToPort:
Incorrect argument label in call (have ':error:', expected ':interface:')
Looking at the declaration of the bindToPort method in the library, I have a prototype corresponding to my implementation.
- (BOOL)bindToPort:(UInt16)port error:(NSError **)errPtr
Why do I still got this error even if the prototype is respected?