Skip to content

Instantly share code, notes, and snippets.

@alyssais
Last active August 29, 2015 14:02
Show Gist options
  • Save alyssais/ccb43caeb92d52f77e63 to your computer and use it in GitHub Desktop.
Save alyssais/ccb43caeb92d52f77e63 to your computer and use it in GitHub Desktop.
#import "socket.h"
#import <Foundation/Foundation.h>
CFSocketRef createSocket(void);
#import <sys/socket.h>
#import <netinet/in.h>
#import "socket.h"
CFSocketRef createSocket(void) {
return CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL);
}
import Foundation
class Socket {
let internal: CFSocket
init() {
self.internal = createSocket().takeRetainedValue()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment