|
|
|
@ -52,7 +52,7 @@ void create_addr(int network, char* address, int port,struct sockaddr* dest) {
|
|
|
|
|
int create_local (int network, char transport, char* address, int port,struct sockaddr* addr_struct) {
|
|
|
|
|
int socket = create_socket(network,transport);
|
|
|
|
|
if (socket < 0) {
|
|
|
|
|
printf("Something went wrong creating the socket: %s\n",strerror(errno));
|
|
|
|
|
exit(socket);
|
|
|
|
|
}
|
|
|
|
|
create_addr(network,address,port,addr_struct);
|
|
|
|
|
int addrlen;
|
|
|
|
@ -70,8 +70,7 @@ int create_local (int network, char transport, char* address, int port,struct so
|
|
|
|
|
|
|
|
|
|
int i = bind (socket,addr_struct,(socklen_t)addrlen);
|
|
|
|
|
if (i < 0) {
|
|
|
|
|
printf("Something went wrong: %s\n",strerror(errno));
|
|
|
|
|
exit(-3);
|
|
|
|
|
exit(errno);
|
|
|
|
|
}
|
|
|
|
|
return socket;
|
|
|
|
|
}
|
|
|
|
@ -100,8 +99,7 @@ int create_remote (int network,char transport,char* address,int port) {
|
|
|
|
|
|
|
|
|
|
int i = connect(socket,&remote_addr_struct,(socklen_t)addrlen);
|
|
|
|
|
if (i < 0) {
|
|
|
|
|
printf("Something went wrong: %s\n",strerror(errno));
|
|
|
|
|
exit(-3);
|
|
|
|
|
exit(errno);
|
|
|
|
|
}
|
|
|
|
|
return socket;
|
|
|
|
|
}
|
|
|
|
|