Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewController.h"
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <arpa/inet.h>
- @interface ViewController ()
- @end
- @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("192.168.100.101");
- sendto(sock, "HELLO", 5, 0, (struct sockaddr *)&addr, sizeof(addr));
- close(sock);
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement