Compare commits

..

2 Commits

Author SHA1 Message Date
be336f01dc Added include guards 2023-02-22 22:40:35 -06:00
1731d36735 Updated header inclusion 2023-02-22 22:40:19 -06:00
2 changed files with 12 additions and 3 deletions

View File

@@ -1,7 +1,13 @@
#ifndef EASYSOCK_H_
#define EASYSOCK_H_
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
/* This function takes:
a layer 3 - network layer - integer, which must be '4' for IPv4
@@ -41,4 +47,8 @@ requested address. It is used for remoet sockets (client sockets). The paramters
as above.
It prints the error returned by 'connect' if something went wrong, and exits with error code '-3'.*/
int create_remote (int network,char transport,char* address,int port);
#endif

5
main.c
View File

@@ -1,9 +1,8 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "easysock.h"
void forward_data(int from_fd, int to_fd) {
int n = 0;
char* buffer = malloc(3000*sizeof(char));