-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
87 lines (63 loc) · 1.73 KB
/
main.c
File metadata and controls
87 lines (63 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include<winsock2.h>
#include <ws2tcpip.h>
//#include <wininet.h>
#include <libgen.h>
#include <unistd.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
#include "constants.h"
#include "helper.h"
#include "receiver.h"
#include "sender.h"
#pragma comment(lib,"ws2_32.lib") //Winsock Library
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int choice;
char ipAddress[MAX_IP];
char path[MAX_PATHLEN];
do{
WSAInit();
printf("----------------------------------------------------\n");
printf(" Welcome to File Transer System \n");
printf("----------------------------------------------------\n");
printf("Enter Your Choice (1-3):\n");
printf("--> 1. Receive File\n");
printf("--> 2. Send File\n");
printf("--> 3. Exit \n");
printf("Your Choice : ");
scanf("%d" , &choice);
switch(choice)
{
case 1: printMySystemInfo();
printf("\nEnter your IP Address : ");
scanf(" %s",ipAddress);
// printf("%s ",ipAddress);
// Call Receiver Function here
bindSocket(ipAddress);
WSACleanup();
break;
case 2:
printf("\nEnter Receiver IP Address : ");
scanf(" %s",ipAddress);
printf("\nEnter the File Path : ");
scanf(" %s",path);
// printf("%s %s ",ipAddress,basename(path));
// Call Sender function here
validateInput(ipAddress,path);
WSACleanup();
break;
case 3: WSACleanup();
return 0;
break;
default :
printf("\n Please Enter valid choice");
break;
}
printf("\nPress Any Key to continue ->\n");
getch();
}while(1);
// printf("%s %s %d",ipAddress,basename(path),choice);
return 0;
}