bcssocket/include/sockets.h

24 lines
560 B
C

#ifndef SOCKETS_H
#define SOCKETS_H
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "errors.h"
#define PORT 8080
#define MAX_PEND_REQ 5
int createSocket();
void setSockOptions(int fd);
void setSockAddress(int argc, char *argv[], struct sockaddr_in * address, in_addr_t inAddress);
int bindAndGetSocket(int fd, struct sockaddr_in *address);
void connectToSocket(int fd, struct sockaddr_in *address);
void closeSocket(int fd);
#endif