generated from AfonsoCMSousa/CPP-Template
24 lines
549 B
C
24 lines
549 B
C
#ifndef SOCKET_H
|
|
#define SOCKET_H
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <unistd.h>
|
|
#include <cstring>
|
|
|
|
// =========================
|
|
// UDP SOCKET FUCNTIONS
|
|
// =========================
|
|
// Server hosts a UDP socket at 127.0.0.1:12000
|
|
// Client sends a message to the server at 11000
|
|
|
|
int connect_udp_socket(const char* ip, int port);
|
|
|
|
int bind_udp_socket(int sockfd, const char* ip, int port);
|
|
|
|
int send_udp_message(int sockfd, const char* message, const char* dest_ip, int dest_port);
|
|
|
|
#endif // SOCKET_H
|
|
|