Compare commits
2 Commits
62467b7926
...
be336f01dc
Author | SHA1 | Date | |
---|---|---|---|
be336f01dc | |||
1731d36735 |
10
easysock.h
10
easysock.h
@@ -1,7 +1,13 @@
|
|||||||
|
#ifndef EASYSOCK_H_
|
||||||
|
#define EASYSOCK_H_
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
/* This function takes:
|
/* This function takes:
|
||||||
a layer 3 - network layer - integer, which must be '4' for IPv4
|
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.
|
as above.
|
||||||
|
|
||||||
It prints the error returned by 'connect' if something went wrong, and exits with error code '-3'.*/
|
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);
|
int create_remote (int network,char transport,char* address,int port);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
5
main.c
5
main.c
@@ -1,9 +1,8 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <stdlib.h>
|
||||||
|
#include "easysock.h"
|
||||||
void forward_data(int from_fd, int to_fd) {
|
void forward_data(int from_fd, int to_fd) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
char* buffer = malloc(3000*sizeof(char));
|
char* buffer = malloc(3000*sizeof(char));
|
||||||
|
Reference in New Issue
Block a user