The experiment of file transfer in embedded system

Source: Internet
Author: User

TCP network communication programming, multithreading (code see appendix)

Experimental Purpose:

Realize PC and IoT test box transfer file, PC as client, enter a file name on PC, upload to object by programmed program
Networked Test Chambers. The transport protocol uses the TCP protocol. Running the client on the Linux system of the PC, on the Linux system of the IoT test case
Row server.
Experimental steps:
(1) Open the virtual machine (Unbuntu system) on the PC side, connect the board to power and connect the development Board to the PC using the network cable.
(2) Use the command ifconfig eth0 192.168.1.21 to set the PC-side IP address,
and set the development Board side IP to 192.168.1.20 in the setup of the Experiment Board.
(3) Use the command Telnet 192.168.1.20 to connect to the Development Board on the PC side
(4) Open a new terminal window, copy the written pthreadserver.c through the PC command to the develop directory, and use
Command Arm-linux-gcc–o Pthreadserver pthreadserver.c–lpthread to cross-compile the server-side program.
(5) Then use the command in the Development Board: Mount–o nolock–t nfs192.168.1.21:/home/unsp/develop//mnt,
Mount the develop directory on the PC side to the MNT directory of the Development Board.
(6) Use the command in the home directory of the Development Board: Mkdirserver, create a new server-side directory, and then enter the/MNT directory to use
Command: PC pthreadserver/home/server, copy the server-side program to the new directory.
(7) Use the command in the/home/server directory of the Development Board:./pthreadserver, open the server-side program.
(8) Use the command on the PC side:./client192.168.1.20, open the client program, and according to the prompt message (please Input File
Name onclient) Enter the name of the file that exists in the directory where the client resides. (You can open multiple clients to transfer files simultaneously)
(9) The transfer file is successful, the client program displays the successful message and exits, the server-side program displays the received data success information and continues to monitor
(10) Use the command CTRL + C to end the server-side program and use the command: Ls–l,
You can view file information that is transferred from the client to the server side.

Note: Can be tested on PC side (ip:127.0.0.1)

Experimental results:

(1) Telnet, Mount:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/78/93/wKioL1Z_x1SCWbg8AAQi-TuyAj0413.jpg "title=" mount. jpg "alt=" Wkiol1z_x1scwbg8aaqi-tuyaj0413.jpg "/>

(2) Cross-compiling:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/78/93/wKioL1Z_x3_QhFwYAAGz0ocXowI493.jpg "title=" Cross-compiling. jpg "alt=" wkiol1z_x3_qhfwyaagz0ocxowi493.jpg "/>

(3) Multi-threaded File transfer demo:

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/78/95/wKiom1Z_x_2hxLaxAAQ0xaYVlAo802.jpg "title=" dd.jpg "alt=" Wkiom1z_x_2hxlaxaaq0xayvlao802.jpg "/>

This article from "Not Daze" blog, please make sure to keep this source http://tobeys.blog.51cto.com/10620284/1728861

The experiment of file transfer in embedded system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.