/
client.c
46 lines (28 loc) · 898 Bytes
/
client.c
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
#include "rdt.h"
void *senderFunction(char *fileName){
rdpSend(fileName);
// while(1){} // for testing only
}
void *recvFunction(){
recvThread();
// while(1){} // for testing only
}
int main(int argc,char *argv[]) {
pthread_t timerThread, senderThread, receiverThread;
int nReceivers,size,mss;
int iret1,iret2,iret3;
//strcpy();
nReceivers = (argc -3 )/2;
initReceivers(argv,nReceivers);
size = atoi( argv[argc-2] );
mss = atoi( argv[ argc-1 ] );
initWindow(size,mss);
printWindowInfo();
printReceiverList();
iret1 = pthread_create( &senderThread, NULL, senderFunction,(void *) argv[argc-3]);
iret2 = pthread_create( &receiverThread, NULL, recvFunction, NULL);
iret3 = pthread_create( &timerThread, NULL, timer, NULL);
pthread_join( timerThread, NULL);
pthread_join( receiverThread, NULL);
pthread_join( timerThread, NULL);
}