udp.h 473 Bytes
#ifndef UDP_H
#define UDP_H

#include <iostream>

#include <string.h>
#include <cstdlib>

#include <arpa/inet.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>

using namespace std;

void setupSocket(uint16_t port, char *hostname, struct hostent *host, int timeout, struct sockaddr_in *si, int *s);
int sendMsg(int s, char *msg, size_t msgLength, struct sockaddr_in *si);
int recvMsg(int s, char *msg, size_t msgLength, struct sockaddr_in *si);

#endif