C/S File Transfer CLI

Introduction

This project is designed for the user who like using ubuntu command line to communicate with the server.

Environment

  • NetBean
  • Java 8 oracle
  • MongoDB

After you prepare all things above, just download this project or use the git clone it to your local disk.Do not forget to download the server end program along with it.

How to ?

  1. open two terminals
  2. run the jar file under /projectdir/dist/FileTransferServer.jar
  3. run the FileTransferClient.jar in the other terminal.

Description

While as we know, there are several differences between the CLI and the Swing version.
Here we just talk about the CLI client.

The CLI version is designed to transfer the content in the .xls or .xlsx file to the server, then the server program will save the data in the MongoDB database.

look at the sample table from the sync .xls file:

namesexagesalarylocationintrestself-intropicture
Johnmale232000AmericasoccerJohn.txtJohn.jpg
Lucyfemale203500EnglendpianoLucy.txtLucy.jpg

As for the name/sex/age/salary/location/intrest will save in the MongoDB as Mongo Objects, and the files the person contains will be sliced and indexed in the MongoDB, you can use mongofile command to get the file out from the database.

Before you get the person file, you should look at the source code and find the database and collections where the file saved and indexed.

Every time you want to transfer the data to the database, you just add the items in the .xls or .xlsx file in the /FileTransferClientCLI/FileList directory, and place the .txt and .jpg file in the /FileTransferClientCLI/FileDirectory directory.Finally just start the server first and start the client, the file will automatically transferred to the server, you can open several client at the same time because the server keep multi-thread work.

Run Details

I. in a terminal find the server jar file, type

java -jar FileTransferServerCLI.jar  port [multi-client-mode]

# the port is mandated, you can't ignore them.
# the multi client flag is optional, if you want to use multi client just set the 
# flag with true, like:
    java -jar .jar 8888 true

II. in another terminal find the client and run the jar file,

java -jar FileTransferClientCLI.jar ip port 

# here the ip and port number is mandated.
# the ip is the server ip when you open your server the ip will show in the window
# Actually if you run two program in the same machine, the ip is same with your 
# local machine.

Tips

If you want to use this code in your own project please keep the author in your code.No manners, No success.

see source code at GitHub.

Contact

  1. Email: 294101042@qq.com
  2. QQ: 294101042
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值