Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#import "ViewController.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@interface ViewController ()
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
- (IBAction)clickedSendButton:(id)sender {
int sock;
struct sockaddr_in addr;
sock = socket(AF_INET, SOCK_DGRAM, 0);
addr.sin_family = AF_INET;
addr.sin_port = htons(8888);
addr.sin_addr.s_addr = inet_addr("");
sendto(sock, "HELLO", 5, 0, (struct sockaddr *)&addr, sizeof(addr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.