|
|
@ -73,6 +73,9 @@ int main(int argc,char* argv[]) {
|
|
|
|
char preferred_transport = 'T';
|
|
|
|
char preferred_transport = 'T';
|
|
|
|
struct sockaddr addr_struct;
|
|
|
|
struct sockaddr addr_struct;
|
|
|
|
int server_sock = create_local(preferred_local_network,preferred_transport,local_addr,local_port,&addr_struct);
|
|
|
|
int server_sock = create_local(preferred_local_network,preferred_transport,local_addr,local_port,&addr_struct);
|
|
|
|
|
|
|
|
if (server_sock < 0) {
|
|
|
|
|
|
|
|
exit(-1 * server_sock);
|
|
|
|
|
|
|
|
}
|
|
|
|
int addrlen;
|
|
|
|
int addrlen;
|
|
|
|
if (check_ip_ver(local_addr) == 4) {
|
|
|
|
if (check_ip_ver(local_addr) == 4) {
|
|
|
|
addrlen = sizeof(struct sockaddr_in);
|
|
|
|
addrlen = sizeof(struct sockaddr_in);
|
|
|
@ -90,6 +93,9 @@ int main(int argc,char* argv[]) {
|
|
|
|
while (1) {
|
|
|
|
while (1) {
|
|
|
|
int from_client = accept(server_sock,&addr_struct,(socklen_t *)&addrlen);
|
|
|
|
int from_client = accept(server_sock,&addr_struct,(socklen_t *)&addrlen);
|
|
|
|
int to_server = create_remote(preferred_remote_network,preferred_transport,remote_addr,remote_port,&remote_addr_struct);
|
|
|
|
int to_server = create_remote(preferred_remote_network,preferred_transport,remote_addr,remote_port,&remote_addr_struct);
|
|
|
|
|
|
|
|
if (to_server < 0) {
|
|
|
|
|
|
|
|
exit(-1 * to_server);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printf("Connection established to %s:%d\n",remote_addr,remote_port);
|
|
|
|
printf("Connection established to %s:%d\n",remote_addr,remote_port);
|
|
|
|
if (fork() == 0) {
|
|
|
|
if (fork() == 0) {
|
|
|
|