Compare commits

...

11 Commits

@ -1,4 +1,7 @@
# Projet Répartition : Téléchargement FTP P2P # Projet Répartition : Téléchargement FTP P2P
## Documentation
The report asked can be found in [doc/report.pdf](doc/report.pdf).
## Protocol ## Protocol
Documentation of the protocol used can be found in [doc/protocol.md](doc/protocol.md). Documentation of the protocol used can be found in [doc/protocol.md](doc/protocol.md).
@ -14,6 +17,7 @@ Documentation of the protocol used can be found in [doc/protocol.md](doc/protoco
### Application CLI (Client+Server) ### Application CLI (Client+Server)
- Interactive mode: `java clientP2P.ClientP2P` - Interactive mode: `java clientP2P.ClientP2P`
- CLI Arguments mode: `java clientP2P.ClientP2P -- <clientTransportProtocol> <integratedServerHOSTNAME> <integratedServerPORT> <trackerHOSTNAME> <trackerPORT>` (default tracker port 6969 (range 7000 -> 7999) and server port: server 7070 (range 7000->7070)) - CLI Arguments mode: `java clientP2P.ClientP2P -- <clientTransportProtocol> <integratedServerHOSTNAME> <integratedServerPORT> <trackerHOSTNAME> <trackerPORT>` (default tracker port 6969 (range 7000 -> 7999) and server port: server 7070 (range 7000->7070))
- CLI Arguments mode when using with a nat: `java clientP2P.ClientP2P -- <clientTransportProtocol> <integratedServerPublicHOSTNAME> <integratedServerPublicPORT> <trackerHOSTNAME> <trackerPORT> <serverBindingHOSTNAME> <serverBindingPORT>` (default tracker port 6969 (range 7000 -> 7999) and server port: server 7070 (range 7000->7070))
### Application GUI (Client+Server) ### Application GUI (Client+Server)
- `java gui.Gui` - `java gui.Gui`

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 43 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 37 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.7 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 184 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 102 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 84 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 288 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 137 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 61 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 116 KiB

@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2020-04-14T20:21:49.648Z" agent="5.0 (X11)" etag="T4xjJPgOwcg8meu_05yP" version="12.9.12" type="device"><diagram name="Page-1" id="13e1069c-82ec-6db2-03f1-153e76fe0fe0">7VxZc6M4EP41rso8ZIrD56PjOJPUZifZ2HPsvMkg26oAYgQ48f761cUl+SCMsTO7nqpJoIGWUH9Sf90t0rJH/usnAsLln9iFXssy3NeWfd2yrJ5l059MsBaCttkVggVBrhCZuWCC/oFSaEhpglwYlW6MMfZiFJaFDg4C6MQlGSAEv5Rvm2Ov3GoIFlATTBzg6dJvyI2XUmoaRn7hFqLFUjbd78gLM+A8LwhOAtley7Ln/J+47INUl7w/WgIXvxRE9rhljwjGsTjyX0fQY0ObDpt47mbL1azfBAZxlQd6MzADptOeOVZv3p4Zl9JwK+AlciyGYeghB8QIB5bsdLxOB4r2P2SHie/dozn0UEDPrkJIkA9jSOgVT4ofc9nVyxLFcBIChz36QhFEZcvY9+iZSQ+pVWNAHyHZueeBMEIz3qpBJQQ6CYnQCj7BSICHSXESs5ZGGSj4rcwY0JWqsvE2uF4fOfLYAzPoXWXWG2EPs+YDzF8oigl+zqDAFM1pH2+AjzyG8K+QuCAAUizhbFJjXgEPLQJ64lB78FfXDSRttoIkhq8FkTTYJ4jpsJE1vUVetVIUrsuT5qWA1PSWZQGkg74UAjk7FpnqHCH0QIKkImD6uwBjngHzDgBj18RL+wB4mV61Z4u7r113+Nf3+7HTj+++DS/NXZixz5h5D5jp1wNNv9cUaCwNNFNCh5K+8Bkvp8dLp1Nzkek2hRedyVzfTUYPX8dPVPo0/uvLeDK9mCMPmh80BBXszoaArkzeUA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yG8R6yyt9GzDBb5Flu/6xM0zdZih0x6hLoc09ipoGSm8HUCRvKvtNtkgkIWGn4oTlkfnpb1KTOd3qYis1mYw2vRk1/T2KDpRRaqswtw9bk9kMST2k303mhHvlih3KTmBGaiRIebVjDl8YgKCDAzcSwOUMCqwwcosER+FDFakcZ4aSGxXca5UqjhDdQpLSPxDx8pAgm4LVFaab8uKEUjrscybnQge5GTWMoOB69P/1+PPfqThMAhQtW1p9x5iKlpj/D0WRSI4pZ5t0eHinwAJwbknnQZlThjhie0bW2biyuzAdTHJmi5XZYrbZZB9bbG4z0obdJRQ9xdjZOPG2ErvCGl81ps7SsVa/b5VMcWnrpmjIDXTV/Yh13YCm6EBuwFQKC903FRbUJMPRCgvW7sjHNKz2aYKfg+yaOl3KUMNv7fyxit+GtpZYCslOt7Q0SmOsY4RgByXP77+w/9shr2Mp7QyOgbz/fEx3XhB/EZaKQ++Zx4ClXuiX7nhThSb3zmyDOgVNdrHkt49QvKmzbr6jIo8Gzro5TQ2cFXOab94IqqyZvV1s82DgfGvSweRv9MxDZsxjXN6IyB74iAbDPJuQhtPsvgsauXJ7hgRGLOh0eVRH4IfqaQKlBw72wyTOMx55BYuiGoh9pSI+R6yKg1j7PoidJYyyZwh0IIWXSDnIHIRIHlTs05fH6+GUb0uTXmbjPtZzvN/K4/YU2ht2rx033k+jsQLuy+a80PfhU4sBn40ot2KQ+DNROGQIm61jDq1IVCxn7N3LGuSzi3ey8+J0ZFZZTvuH2qWlKWq4hJDuyKwEIfuXIWQfG0In+sapbbRLZr209LXiQEjUtn7W/VTEGHzs7FZ1KI6gJE4H1b50elWGUh3a5nNStp5f3eBRp9wxFz7Q4Kl5vOLutJS5lzl6F8bsI0yR7neWIFiIPRySgXgoyraUlLaMsLsCVhmp6OrFJhXp4IuFkrOb3/HNSPbB+d5NIG938/Q0/6saAqX5Xy6xx/8C</diagram></mxfile>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
<mxfile host="app.diagrams.net" modified="2020-03-19T14:50:01.302Z" agent="Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" etag="dOXguTcOAZ-R9XuIfENW" version="12.8.8" type="device"><diagram name="Page-1" id="13e1069c-82ec-6db2-03f1-153e76fe0fe0">7Vtfc+I2EP80zFwfkrEt28BjQkh60+tdEtJrp2/CFqBGWFSI/LlP3xWWDZbAEJ8hZpo8MNJqvZJ2f1rtSkoL9aYvNwLPJr/zmLCW58QvLXTV8rxO2IFfRXhNCX63mxLGgsYpyV0RBvQH0URHUxc0JvMCo+ScSTorEiOeJCSSBRoWgj8X2UacFXud4TGxCIMIM5v6J43lRFNdx1k1/EroeKK77gS6YYijx7Hgi0T31/LQaPmXNk9xJkvzzyc45s9rJNRvoZ7gXKal6UuPMKXaTG3pd9dbWvNxC5LIfT5oD/EQu5E/jLz2yB86Z14q4QmzhdbFg4A5EaHHK18zHcHQZ6q4mLIvdEQYTaB2OSOCTokEfnTFNPl2Rbt8nlBJBjMcqU+fATxAm8gpg5oLRTCoxPCJyOuM4dmcDpe9OkARJFqIOX0i92Se4kZR+UKqnno5Hpasyg4k1qJyVTtLuVMa6TLDQ8Iuc8P1OOOq+4QvJzSXgj/mKFCCRjDGazylTIH7OxExTrAmayS7YMdLzOg4gUoEplhO3baNNtcTEZK8rJG0rW4IB7WJV2DRrZ6vcaPXVUdXn9dAmmF0sobPIGPEemGMc9ErcEBB42NPrCALKz1GYXLuB1YagBXfaRJW2hZWWuji2/AfZYEPtLw/Wrphk9DSsdAyIAIm8+FZmoAVt1GexQ8tsHzlkmxFSqIad0JAW9X1oaw0QyE4vNC6lHy2pllGRlJ9AKJoMn5QbVdnYcHwztENX79DQHsaGQU12Lj9RzIVf9Hf/h7Iq3+vF/0wnm6ITO/7N58HD/37T79Yxl6zpGm9IZeST6GBJPGFyhUUjfHosWxxSCzGRG5BoB4ZiQtJha3ZNdVlK0EQhiW4kUJnm1Snpd1yCiNbrcSgaCQ3NFbYnC9ERPRX63mAISg37zZBqQIsQUtL5lOsblzfMu4XMC1Q7vt3lYw7hwHLzLwc5Ga0a8qyjzcAYMmil1GnMiA6bwdEWA8gvG7Rjp5TERAo2CFoCyBAofh1jW2mGOYlA+5s7meFr1RirWgLtqNtcPtpRBkBxffUwQEUvWre5V0BuK9H0kZwzl2/bbn3miBp+qg8h32zj3J3CNoCyZWgjJGPRnNyED/WtZB19XnQ+/a9f5+ha54FsgpfacVbr6Bmwi01UjncSiGJ3s0nItMnmmHovgD0TSSbgmryiabv9dERfGK2uKycy7Pw+JFzHT/nCoL3zLk2Asa1APOTAflJbJn1+6fQqSmID8P3DeKzvPNEo/gyr9iEUL4qLKxQ/siw2HD064VMnZnE9AmKY1UshEl3yoGkLNDjGlcjQVQaGqFGux4roulWxFhgxuamoJpCI98r9oPaTum4svYt/AcKpeyLMTO/9Fb55SkE/GWusanQNnbVymmnH+4QVBO0A/PA1by6N8eFSvkPBO3/50GdVvmZc+6gUAs+AGSN232/sjd2dghqwEmJax/CpfkmsmD0kW8eP98MjY2zAfmmfc/X8Hxz9xYanNQWmu0wP72FWoJq2kJDw4G63WNsifZjhVPaEstw2YSstyrmrKx3T8zVBgv7KqDkkulkk4APD1ZvEmAG9f6O/LZTyn8Yj5fNfb/8tqH3p6WnNp09UL3vhVZ+x+o4CBW3JzumquvO1cxZg4q497rd86BcVF0PAYwTpCyQ3Dqydil/Efm2gopzOFyak0feW26E72C5RBNKxCkuk4YfbppZsFuT87cE1XXvaxxuhsc40fE8C6BfASpg1QmB32j5oh8Kj4n6r5rslYKrppXEeR2pNBA/Ee3zAXUXUIQsOGEcK7YIJ/A7JGOanFtAP/rTzK1wf8MjWMP/hBsy5MyAhQy5bYCnvgeS9rHzHo9PTiHyPK33JqbfCaq+wTNPeMMDbb3muWN2j1zR70B19Q9sKfvqnwRR/z8=</diagram></mxfile> <mxfile host="Electron" modified="2020-04-14T15:11:32.653Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.9.9 Chrome/80.0.3987.163 Electron/8.2.1 Safari/537.36" etag="4cQkucbfenyZyzuZQdJm" version="12.9.9" type="device"><diagram name="Page-1" id="13e1069c-82ec-6db2-03f1-153e76fe0fe0">7Ztbc6s2EIB/jWdOH5IBBL48Jo6Tnulpm8TpaadvMsi2JjJyhZxLf31XRmCQbOxDcIKnyYNHLGKFtB+rXUnpoOHi5Ubg5fxXHhHW8ZzopYOuOp438LvwqwSvqaCLBqlgJmiUityNYEz/JVroaOmKRiQpVZScM0mXZWHI45iEsiTDQvDncrUpZ+VWl3hGLME4xMyW/kkjOddS13E2N34mdDbXTfcDfWOCw8eZ4KtYt9fx0HT9l95e4EyXrp/MccSfCyI06qCh4FympcXLkDA1tNmwpc9d77ibv7cgsTzkgd4ET7Ab+pPQ6039iXPmpRqeMFvpsXgQ0Cci9PvK12yM4NWXqrhasG90ShiN4epySQRdEAn10RXT4tuN7PJ5TiUZL3GoHn0GeEA2lwsGVy4UwaASwyMiv2YMLxM6WbfqgESQcCUS+kTuSZJyo6R8JVVLw5yHdVVlBxJpVflQO2u9CxrqMsMTwi5zww0546r5mK87lEjBH3MKlKIpvOM1XlCm4P5ORIRjrMWaZBfseIkZncVwEYIp1l23baPN9USEJC8FkbbVDeEwbOIVqmR3M85ey9/LcwHSjNF5gc+gr4VYfxizXPUGDihoPg5kBVmsDBmFzrmfrLSAFeS2iZW+xcqYCOjMJyttYOVDUen9ES/EX/SXv8fy6p/r1agbLbZMQ/ejm6/jh9H9l58sYgp2Vl2mMI9f6EGacCn5Am6QOLpQgYGSMR4+Vo2bxGJGZPUESaJSBGGPbGHsslEShGEJhJXDlS1Dp7XdcgpvlhupWzbSwBj7hK9ESPQzxSnfUOP61XrS3lt61mbM+1ffsr5l2W9gV5Dcj+5qWTaBF5aZbTnozWTXlGUPb7H+uor+rvq1aej/OA3dZmjwHOObRTV5MLmyFO0AAgYUvxaqLVWFZPcLu4Pt7Wz4SjU2Sluwm7bx7ZcpZQQGfqhSBCh69VzLhwJ4qDvSRnDOXb9nOfeGkDRB6tX1UN4eRTuI3CjKKvLpNCFHcWMDC6yrr+Ph799H9xlcSRbfKLzSC694gdpJW2qkatoqiUQf5hKR4RLzOOZHAUTdPYoaconmF5O1e1SXmPXFCsU9i8fPUPz9Q3Hf9KIfHou7rgXMG4Pxk5gxm/dPgdtMBB/0PjSCd+3k7JRC+Cqf2IY4vi4VVvj1zlj0LCo6XpfBqF9G9AmKM1UsBUl3yn2kVaDFQq1WQlQZGKFWOx4rnvFqMuZ7exQ1FBghZARGjlP5XvkSy/b6Rwqk7PVvM7n0NsnlKYT7Va6xrWibS5d1k07U26OoIbR9ox0vqEYb+ZX1j4T2/3OVTg/5mXPuoK5WfARkjU08v7Y3dvcoasE6iWuvwKXZJrIw+sw23z/bDIyJswXZZtcCpuXZ5v4pNDipKTSbYd48hVqKGppCA/MUhPceU6K9g31KU2IVl23IeusyZ2W9BzLXGBb2RkDFDtPJJgGfHqzZJMAM6nt78ttBZf3jeLwsmjwsv23p5mnlqk3/AKoP3c7KN1gdB6GyS7Jjqoa4N1NWMyg72Ik6g/OgWlVThwCMBaRsSXznVnC/sn4ZfPvpch+Ol+XkgfeO7eA7+FrCOSXiFL+Slq9tGr4/Xy95q++3FDW16WusbQbvsaDjeRagvwEqYNU5gd9wfW4XCo+xOjufHVFwVbfiKL9GKgvET0S7fKDuAoqQBMeMY1UtxDH8TsiMxucW6Fl+H3NJ9ifuOhd3/S3fheTLQj7MyFRtGiSgisazB3Xv6qzbUH5ctlXXsX15kM3NxfzYPEPV3MFIe9H5gIMnpxB3nthZE3Ptre7xO3N911pZaWpLxUA5w7am24HLzX+ppNU3/wmERv8B</diagram></mxfile>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 27 KiB

@ -0,0 +1 @@
<mxfile host="Electron" modified="2020-04-15T12:28:01.042Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.9.9 Chrome/80.0.3987.163 Electron/8.2.1 Safari/537.36" etag="rd-03VK3YZivAI2uokKE" version="12.9.9" type="device"><diagram id="jCZ_pu6ezyKGmVCC1v1x" name="Page-1">7V3dcps4FH4aT6/SAWR+fJk4abrddqfbtNv0khjFVoORB0Ri9+lXAmGQRGxiG0RidyYNkoUMn74jnT8pAzCeL69jfzH7ggMYDiwjWA7A5cCyLNcA9BerWeU1pmc5ec00RgGvKytu0B/IKw1em6IAJkJDgnFI0EKsnOAoghMi1PlxjJ/EZvc4FL914U+hUnEz8UO19icKyCyv9Sy3rP8I0XRWfLPpjPJP5n7RmL9JMvMD/FSpAlcDMI4xJvnVfDmGIUOvwCW/78Mzn64fLIYRaXLDcvHxYfrgmBdfHPvPl7+Ny4sfZ2eWl3fz6Icpf+MfBIUo8QlMY/7gZFWgQd9hwS7TeXg+ITgegItHGBNE8frs38HwK04QQTiiTe4wIXhOG4Tsgwt/8jCNcRoFYxyy+2hv4D77V+njPERTdi/BC1o7I/OQFkx6iVMSogiO14Ns0EoVAI4J6w4uK1UckGuI55DEK9qkICgfmzU7efmpHGrAq2aVUXZ4nc/JNV13XOJPL/gQvGA4wFAZDmUMMhRhwEF4miECbxb+hH36RIVQBO4AGJmWLYBkqRh5bg1Ipum2BpOtwHSzSshgDAbn3hwqkNE3JSIuPmfahOIC4xoKzlEQsNsvYpigP/5d1hUDfIFRRLIXsi8G9iXrKyWU9tnE1R3kTg3iVmt4Oz2kpS1iNKyhZa3s2q2h5CoonS8WIWVVNiW+elJuB7xuGmiNlMXjVCCFAV27eRHHZIanOPLDq7L2QmRp2eYzZktOBtVvSMiKKyIMRXGM4BKR28r1L9bVe5uXLpe856ywKgoRfd/baqFyFyuWt2Wl4r7AT2bZs2ZfFgXnTJ9h/Aj9JEGTvPIDCrdKVYLTeMIxGidL458Pt/b1018/kz9Xj/+M59MzLs7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muz6UIdAZM1l7z/UFkYEKyNvyJHSX+jXkFs9W02h4cF/CfjKkZhKwSHgaEr5Nqi/i4xhuz8THrtOGJYS634YnouTWzdEAqCgpobKDwVR0fJpl9p9l1nvut80yVj9STIGcXeZt9vfJ7T17JPGvBX+fq4rtiaBtE9RtmoLQb4KOhh04pD3zRNDOCVpYMq+coKYBDsvQ8Bqi20/R7Of4V/Tt/lMCz76Rs+MiaBfTYzsRx87ZZ5odzI+WqohfCTsl04j5AfwNpz90ugfME13G7lB3QrSlOrvuKZUjxMALKYwMvl7s0wVSxkUPsNNzDsGbTGBqbt60cxBBzXwmhg7cXRMyXEfsaNhSBhOQ9pdKE3ZL86/qQyqnD/2eI3nO8Ar26PMcWQpg35/Zx//aggSmLQZy6hxQnR6WZavBtpssKpDvq0jEMxWCvp6p4NTg2HG04OTHO5gVWpyVsD1a0K9EKltVFGnHVHbYl9Gf3zjNVEbYk4lfSmjXHzKoO7nvuKPKciLaenXQFVW21TNYj36MJLO+7tSSTsfIOSWibcvO0C5HjqrkHnkimjt0ezZE6nL+b0rvU7xlRoCSBU7W2TR92IMsr+4j3Yu7c1rct6VemoapmfHqocBHPilZ0hYbbzjSPEQv07+OYIiAlBzr6l43XFX9qjMDs+Mq+mAGyidvjbSfvOW+LL34CEguz0MjoEZ2uiW5ml1cCYoxmhMfZbqSVm5LW4SMmsT5jqn9ss12R0ht0zQ0c7v4sue5XUR9g+yM5ooxoDv+K8/lpqHdM17E80+Mf5bxhtUa42mx/KtNeUiz/ONX4Op/</diagram></mxfile>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 46 KiB

@ -1 +0,0 @@
<mxfile host="www.draw.io" modified="2019-12-12T10:16:53.052Z" agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15" etag="9ujBaeT0R9HPyrINtYEh" version="12.3.9" type="device" pages="1"><diagram id="jCZ_pu6ezyKGmVCC1v1x" name="Page-1">7VjJkpswEP0aH5NiMV6OGbwkVZO5+DCTo8p0QClBu0Tb4Pn6SKYxEDKTpeIYV83FpX4tCek9qR9m5IdpudZil3zGCNTIc6Jy5C9Gnjf3PfNrgWMFTMazCoi1jCrIbYCNfAYGHUb3MoK805EQFcldF9xilsGWOpjQGotut6+ouk/diRh6wGYrVB99lBElFTrzpg3+EWSc1E92J/Mqk4q6M+8kT0SERQvylyM/1IhUtdIyBGW5q3mpxq1eyJ4XpiGj3xkQ5qXzsHoK1sWnx/x5eXgI0/gdq3MQas8bXmCRKRQRL5qONRNmNkO6Ce6KRBJsdmJrM4WR3WAJpcpErmn2F8ZrPYAmKFsQL3QNmALpo+nCWc/xqyF8anzmsGgkcMeMJS36p4wJVj0+z9wQYxrMzR/wNO7xdC9zsgdKKnM8h8SV612brKBHFsGJLCgNaZAZLoZE2LnWXI0w1+8TEpkyxCFqSjDGTKhlg95p3GcR2GkdEzV97hF3TNY3IDpyTRV7wi6VRg16arW/2KneBxwtSp75FBzrIDP7fWoHrVE2bIadomZc9MFWYxNmmEGFrKSl6ZR/UdYc93oLr3HHopDQMdCvS50l9tVTokEJkodu/f/3ko/fJL+45ONhSR68SX5xyYNhSe70rDBU0u7+x5PQ1fnyJlj72/mlIeh7oPcTD5xczAMn17wdzt/cDncwt6P+Z3RjHji9HcmvLt3AvGx2O9Ld7G0dmJfVHtN42Qa0cZyre5k//39mZsLmk80p1/ru5S+/Aw==</diagram></mxfile>

@ -29,6 +29,7 @@ public class ClientP2P {
private Directories directories; private Directories directories;
private HostItem tracker; private HostItem tracker;
private HostItem server; private HostItem server;
private HostItem serverBinding;
private Scanner scanner; private Scanner scanner;
final static boolean DEBUG = false; final static boolean DEBUG = false;
@ -46,14 +47,17 @@ public class ClientP2P {
} }
/** Constructor. /** Constructor.
* @param hostnameServer hostname to bind * @param hostnameServer hostname used to register
* @param portServer port to bind * @param portServer port used to register
* @param hostnameServerBinding hostname to bind
* @param portServerBinding port to bind
* @param hostnameTracker hostname of tracker * @param hostnameTracker hostname of tracker
* @param portTracker port of tracker * @param portTracker port of tracker
*/ */
public ClientP2P(String hostnameServer, int portServer, String hostnameTracker, int portTracker) { public ClientP2P(String hostnameServer, int portServer, String hostnameServerBinding, int portServerBinding, String hostnameTracker, int portTracker) {
scanner = new Scanner(System.in); scanner = new Scanner(System.in);
server = new HostItem(hostnameServer, portServer); server = new HostItem(hostnameServer, portServer);
serverBinding = new HostItem(hostnameServerBinding, portServerBinding);
tracker = new HostItem(hostnameTracker, portTracker); tracker = new HostItem(hostnameTracker, portTracker);
initDirectoriesAndLoggers(); initDirectoriesAndLoggers();
System.out.println("Server will listen on port " + portServer + " and serve files from " + directories.getDataHomeDirectory()); System.out.println("Server will listen on port " + portServer + " and serve files from " + directories.getDataHomeDirectory());
@ -72,6 +76,12 @@ public class ClientP2P {
"<clientTransportProtocol> " + "<clientTransportProtocol> " +
"<integratedServerHOSTNAME> <integratedServerPORT> " + "<integratedServerHOSTNAME> <integratedServerPORT> " +
"<trackerHOSTNAME> <trackerPORT> "); "<trackerHOSTNAME> <trackerPORT> ");
System.out.println("or");
System.out.println("\tjava clientP2P.ClientP2P -- " +
"<clientTransportProtocol> " +
"<integratedServerPublicHOSTNAME> <integratedServerPublicPORT> " +
"<trackerHOSTNAME> <trackerPORT> " +
"<integratedServerBindingHOSTNAME> <integratedServerBindingPORT>");
System.out.println("(" + trackerPortRange + " and " + serverPortRange +")"); System.out.println("(" + trackerPortRange + " and " + serverPortRange +")");
} }
@ -82,6 +92,8 @@ public class ClientP2P {
*/ */
public static void main(String [] args) { public static void main(String [] args) {
final String defaultHostname = "localhost"; final String defaultHostname = "localhost";
String hostnameServBind = "";
int portServBind = 0;
String hostnameServer = ""; String hostnameServer = "";
int portServer = 0; int portServer = 0;
String hostnameTracker = ""; String hostnameTracker = "";
@ -91,16 +103,25 @@ public class ClientP2P {
final ServerPortRange serverPortRange = new ServerPortRange(); final ServerPortRange serverPortRange = new ServerPortRange();
final TrackerPortRange trackerPortRange = new TrackerPortRange(); final TrackerPortRange trackerPortRange = new TrackerPortRange();
if ((args.length != 6) && (args.length != 0)) { if ((args.length != 6) && (args.length != 0) && (args.length != 8)) {
ClientP2P.printUsage(serverPortRange, trackerPortRange); ClientP2P.printUsage(serverPortRange, trackerPortRange);
System.exit(1); System.exit(1);
} } else if (args.length == 6) {
else if (args.length == 6) { protocolClient = args[1];
hostnameServer = args[2];
portServer = Integer.valueOf(Integer.parseInt(args[3]));
hostnameTracker = args[4];
portTracker = Integer.valueOf(Integer.parseInt(args[5]));
hostnameServBind = hostnameServer;
portServBind = portServer;
} else if (args.length == 8) {
protocolClient = args[1]; protocolClient = args[1];
hostnameServer = args[2]; hostnameServer = args[2];
portServer = Integer.valueOf(Integer.parseInt(args[3])); portServer = Integer.valueOf(Integer.parseInt(args[3]));
hostnameTracker = args[4]; hostnameTracker = args[4];
portTracker = Integer.valueOf(Integer.parseInt(args[5])); portTracker = Integer.valueOf(Integer.parseInt(args[5]));
hostnameServBind = args[6];
portServBind = Integer.valueOf(Integer.parseInt(args[7]));
} else { } else {
System.out.println("Client, wich transport protocol do you want to use (default = TCP): "); System.out.println("Client, wich transport protocol do you want to use (default = TCP): ");
protocolClient = scanner.nextLine(); protocolClient = scanner.nextLine();
@ -132,19 +153,22 @@ public class ClientP2P {
} else { } else {
portTracker = Integer.valueOf(Integer.parseInt(portTrackerStr)); portTracker = Integer.valueOf(Integer.parseInt(portTrackerStr));
} }
hostnameServBind = hostnameServer;
portServBind = portServer;
} }
boolean serverInRange = serverPortRange.isPortInRange(portServer); boolean serverInRange = serverPortRange.isPortInRange(portServer);
boolean serverBindInRange = serverPortRange.isPortInRange(portServBind);
boolean trackerInRange = trackerPortRange.isPortInRange(portTracker); boolean trackerInRange = trackerPortRange.isPortInRange(portTracker);
if (serverInRange && trackerInRange) { if (serverInRange && trackerInRange & serverBindInRange) {
System.out.println("using hostname : " + hostnameServer); System.out.println("using hostname : " + hostnameServer);
System.out.println("using port : " + portServer); System.out.println("using port : " + portServer);
System.out.println("tracker hostname : " + hostnameTracker); System.out.println("tracker hostname : " + hostnameTracker);
System.out.println("tracker port : " + portTracker); System.out.println("tracker port : " + portTracker);
ClientP2P c = new ClientP2P(hostnameServer, portServer, hostnameTracker, portTracker); ClientP2P c = new ClientP2P(hostnameServer, portServer, hostnameServBind, portServBind, hostnameTracker, portTracker);
ServerManagementUDP smudp = new ServerManagementUDP(c.directories.getDataHomeDirectory(), c.server, c.tracker, c.loggerServer); ServerManagementUDP smudp = new ServerManagementUDP(c.directories.getDataHomeDirectory(), c.serverBinding, c.server, c.tracker, c.loggerServer);
ServerManagementTCP smtcp = new ServerManagementTCP(c.directories.getDataHomeDirectory(), c.server, c.tracker, c.loggerServer); ServerManagementTCP smtcp = new ServerManagementTCP(c.directories.getDataHomeDirectory(), c.serverBinding, c.server, c.tracker, c.loggerServer);
Thread tudp = new Thread(smudp); Thread tudp = new Thread(smudp);
tudp.setName("server UDP P2P-JAVA-PROJECT"); tudp.setName("server UDP P2P-JAVA-PROJECT");
tudp.start(); tudp.start();
@ -193,6 +217,9 @@ public class ClientP2P {
if (!trackerInRange) { if (!trackerInRange) {
System.err.println("TRACKER: Port not in range. " + trackerPortRange); System.err.println("TRACKER: Port not in range. " + trackerPortRange);
} }
if (!serverBindInRange) {
System.err.println("SERVER-BINDING: Port not in range. " + serverPortRange);
}
System.exit(2); System.exit(2);
} }
} }

@ -45,20 +45,29 @@ public abstract class ServerManagement extends ServeErrors implements Runnable {
protected Logger logger; protected Logger logger;
protected String baseDirectory; protected String baseDirectory;
protected HostItem server; protected HostItem server;
protected HostItem serverBinding;
protected HostItem tracker; protected HostItem tracker;
protected Random punisher = new Random(); protected Random punisher = new Random();
protected RatioWatcher ratioWatcher; protected RatioWatcher ratioWatcher;
/** Constructor */ /** Constructor
public ServerManagement(String baseDirectory, HostItem server, HostItem tracker, Logger logger) { * @param baseDirectory the root directory where files are stored
* @param serverBinding ther server will bind on this hostItem
* @param server the server hostItem used to register on tracker
* @param logger Logger item
* @param tracker Tracker
*/
public ServerManagement(String baseDirectory, HostItem serverBinding, HostItem server, HostItem tracker, Logger logger) {
super(); super();
assert baseDirectory != null : "baseDirectory is null"; assert baseDirectory != null : "baseDirectory is null";
assert serverBinding != null : "serverBinding is null";
assert server != null : "server is null"; assert server != null : "server is null";
assert tracker != null : "tracker is null"; assert tracker != null : "tracker is null";
assert logger != null : "logger is null"; assert logger != null : "logger is null";
stop = false; stop = false;
this.baseDirectory = baseDirectory; this.baseDirectory = baseDirectory;
this.server = server; this.server = server;
this.serverBinding = serverBinding;
this.tracker = tracker; this.tracker = tracker;
this.logger = logger; this.logger = logger;
} }

@ -47,26 +47,37 @@ import serverP2P.FileWatcherTCP;
* @version 1.0 * @version 1.0
*/ */
public class ServerManagementTCP extends ServerManagement { public class ServerManagementTCP extends ServerManagement {
private ServerSocket socket; private ServerSocket socket;
/** Constructor for TCP implementation, with baseDirectory and TCPPort parameters. /** Constructor for TCP implementation.
* @param baseDirectory the root directory where files are stored * @param baseDirectory the root directory where files are stored
* @param hostName the server will bind on this address * @param serverBinding ther server will bind on this hostItem
* @param TCPPort the server will listen on this port * @param server the server hostItem used to register on tracker
* @param logger Logger item
* @param tracker Tracker
*/
public ServerManagementTCP(String baseDirectory, HostItem serverBinding, HostItem server, HostItem tracker, Logger logger) {
super(baseDirectory, serverBinding, server, tracker, logger);
initSocket();
}
/** Constructor for TCP implementation.
* @param baseDirectory the root directory where files are stored
* @param server the server hostItem used to register on tracker
* @param logger Logger item * @param logger Logger item
* @param tracker Tracker * @param tracker Tracker
*/ */
public ServerManagementTCP(String baseDirectory, HostItem server, HostItem tracker, Logger logger) { public ServerManagementTCP(String baseDirectory, HostItem server, HostItem tracker, Logger logger) {
super(baseDirectory, server, tracker, logger); super(baseDirectory, server, server, tracker, logger);
assert baseDirectory != null : "baseDirectory is null"; initSocket();
assert server != null : "server is null"; }
assert tracker != null : "tracker is null";
assert logger != null : "logger is null"; /** Initialize socket */
private void initSocket() {
try { try {
socket = new ServerSocket(server.getPort(), 10, server.getInetAddress()); socket = new ServerSocket(serverBinding.getPort(), 10, serverBinding.getInetAddress());
} catch (SocketException e) { } catch (SocketException e) {
writeLog("Error: cannot listen on " + server, LogLevel.Error); writeLog("Error: cannot listen on " + serverBinding, LogLevel.Error);
System.exit(-1); System.exit(-1);
} catch (IOException e) { } catch (IOException e) {
writeLog("Error: cannot openning socket", LogLevel.Error); writeLog("Error: cannot openning socket", LogLevel.Error);

@ -47,23 +47,35 @@ public class ServerManagementUDP extends ServerManagement {
private DatagramSocket socket; private DatagramSocket socket;
/** Constructor for UDP implementation, with baseDirectory and UDPPort parameters. /** Constructor for UDP implementation.
* @param baseDirectory the root directory where files are stored * @param baseDirectory the root directory where files are stored
* @param hostName the server will bind on this address * @param server the server hostItem used to register on tracker
* @param port the server will listen on this port
* @param logger Logger item * @param logger Logger item
* @param tracker Tracker * @param tracker Tracker
*/ */
public ServerManagementUDP(String baseDirectory, HostItem server, HostItem tracker, Logger logger) { public ServerManagementUDP(String baseDirectory, HostItem server, HostItem tracker, Logger logger) {
super(baseDirectory, server, tracker, logger); super(baseDirectory, server, server, tracker, logger);
assert baseDirectory != null : "baseDirectory is null"; initSocket();
assert server != null : "server is null"; }
assert tracker != null : "tracker is null";
assert logger != null : "logger is null"; /** Constructor for UDP implementation.
* @param baseDirectory the root directory where files are stored
* @param serverBinding ther server will bind on this hostItem
* @param server the server hostItem used to register on tracker
* @param logger Logger item
* @param tracker Tracker
*/
public ServerManagementUDP(String baseDirectory, HostItem serverBinding, HostItem server, HostItem tracker, Logger logger) {
super(baseDirectory, serverBinding, server, tracker, logger);
initSocket();
}
/** Initialize socket */
private void initSocket() {
try { try {
socket = new DatagramSocket(server.getPort(), server.getInetAddress()); socket = new DatagramSocket(serverBinding.getPort(), serverBinding.getInetAddress());
} catch (SocketException e) { } catch (SocketException e) {
logger.writeUDP("Error: cannot listen on " + server, LogLevel.Error); logger.writeUDP("Error: cannot listen on " + serverBinding, LogLevel.Error);
System.exit(-1); System.exit(-1);
} }
} }

Loading…
Cancel
Save