Sunteți pe pagina 1din 3

Computer Networks

Assignment - 2

Aim :
To create an Application Level
FileSharingProtocol with support for download and
uploadforfilesandindexedsearching.

Features:
The system should have
2 clients (acting as servers simultaneously) listening to the
communication channel for requests and waiting to share files (avoiding collisions)
usingan
applicationlayerprotocol
(likeFTP/HTTP).
Eachclienthastheabilitytodothefollowing:
Know the files present
on each others machines in the designated shared
folders.
Downloadfiles
fromthissharedfolder.
Uploadfiles
tothissharedfolder.
Choosebetween
TCPandUDP
fortransferoffilesbetweenthesharedfolders.
Thesystemshould
periodicallycheck
foranychangesmadetothesharedfolders.
Filetransfershouldincorporate
MD5checksum
tohandlefiletransfererrors.

Specifications:
Thesystemshouldincorporatethefollowingcommands:

IndexGetflag(args)
canrequestthedisplayofthesharedfilesontheconnectedsystem.
the history of requests madeby either clients should be maintained at each of
theclientsrespectively.
the
flag
variablecanbe
shortlist,longlistorregex.
shortlist :
flag would mean that the client only wants to know the
names of files between a specific set of timestamps. Thesamplequery
isasbelow.
$>IndexGetshortlist<starttimestamp><endtimestamp>
Output :
should include name, size, timestampandtype of
thefilesbetweenthestartandendtimestamps.
longlist :
flag would mean that client wants to know theentirelistingof
the shared folder/directory including name, size, timestamp and
typeofthefiles.
$>IndexGetlonglist
Output:
similartoabove,butwithcompletefilelisting.

regex :
flag would mean that client wants to know listing of the shared
folder/directory which contain the specified regular expression pattern
givenasinputargumentintheirfilenames.
$>IndexGetregex<regexargument>
Output:
similartoabove,butwithregularexpressionmatch.

FileHashflag(args):
this command indicates that the client wants to check if any of the files onthe
other end have been changed. The flag variable can take two values,
verify
and
checkall
:
verify :
flag should check for the specific file name provided as
command line argument and return its checksum and lastmodified
timestamp.
$>FileHashverify<filename>
Output:
checksumandlastmodifiedtimestampoftheinputfile.
checkall :
flag shouldcheckperformwhatverifydoesforallthe filesin
thesharedfolder.
(HINT : this command can be used for theperiodiccheckofchangesin
thefilesofsharedfolders)
$>FileHashcheckall
Output :
filename, checksum andlastmodifiedtimestamp of all
thefilesintheshareddirectory.
FileDownloadflag(args):
as the name suggests, wouldbe used to downloadfilesfromthesharedfolder
ofconnectedusertooursharedfolder.
the flag variable can take the value
TCP
or
UDP
depending on the users
request.
If a socket is not available, itshould be created and both clients must use this
socketforfiletransfer.
$>FileDownload<filename>
Output :
should contain the filename, filesize, lastmodified timestamp
andtheMD5hashoftherequestedfile.
HINT : the filesize parameter might be used for requesting the client side to
allocatememoryandusetheallocatedmemoryfordownloadingthefile.
FileUploadflag(args):
as the name suggests, would be used to upload a file to the other clients
sharedfolder.
The other client side may respond to this request with a
FileUploadDeny
or
FileUploadAllow
request which would cancel or proceed with the transfer,
respectively.
The client should upload the file, its MD5hash and lastmodifiedtimestamp if
the responseis FileUploadAllow and go backtolisteningtothecommunication
channeliftheresponseifFileUploadDeny.

the flag variable can take the value


TCP
or
UDP
depending on the users
request.
If a socket is not available, itshould be created and both clients must use this
socketforfiletransfer.
$>FileUpload<filename>
Output :
should contain the filename, filesize, lastmodified timestamp
andtheMD5hashoftheuploadedfile.

Instructions:

Thelanguagepermittedforthiscodeis
C
(python/c++/javaarenotallowed).
Put all your codes in a single folder named
FileSharingProtocol
and compress this
to
.tar format and upload it on the courses portal (Failing to follow the submission
formatwouldbepenalised).
The deadlinefor the submission of the assignment is
27th Feb15 10:00PM.
(Start
yourassignmentearly!Itlltakealotoftimetocomplete).
The codefolder should contain a makefile by thename
run.shwhichshouldcompile
theentirecode.(Programsthatdonotcompilewillautomaticallybegiven0marks).
All error scenarios must be gracefully handled (Programs crashing during testing will
bepenalised).
Do attend the tutorial scheduled for
16thFeb15
.Noindividualmails/pingstotheTAs
shall be entertained. Use the courses portal for generaldoubtsdiscussion and
clarification.
You do not have to use threads for this project (You mayuseitforlearningpurposes,
butnobonusmarksshallbegivenforthesame).
Project can bedone ingroups of atmost2(however,theefficiencyandusabilityofthe
application should be better in case of 2 member teams). Only one submission is
required.
PLAGIARISM IN ANY FORM (YES! ANY FORM WHATSOEVER!) SHALL NOT BE
TOLERATEDANDASTRAIGHTFGRADEFORTHECOURSEWILLBEGIVEN.

Therichestpeopleintheworldlookforandbuildnetworks,
everyoneelselooksforwork.

S-ar putea să vă placă și