明远智睿技术论坛

标题: TCP通信编译与移植(附加源码) [打印本页]

作者: KWH    时间: 2020-3-26 09:49
标题: TCP通信编译与移植(附加源码)
主机平台: UBUNTU14.04
硬件平台:明远智睿MY-IMX6-EK140P
内核版本 :linux-4.1.15
交叉编译链:
arm-poky-linux-gnueabi
文件系统:L4115-core-image-base-myimx6a7.tar.bz2



源码加编译好的执行文件:见附件


编译:
1.设置交叉编译工具:
$ source /home/myzr/my-work/03_toolchain/fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi


2.解压压缩包:
$ tar xvf tcp.tar.bz2


3.进入server目录进行编译:
$ cd server
$ $CC server.c -o server.out


测试:
1.把可执行文件server.out移植到开发板中
2.运行:
$./server.out
3.在虚拟机中client目录运行:
$./client 192.168.137.81(开发板ip地址)
4.可在开发板中接收到数据:
OK: Obtain Socket Despcritor sucessfully.
OK: Bind the Port 5000 sucessfully.
OK: Listening the Port 5000 sucessfully.
OK: Server has got connect from 192.168.137.83.
You can enter string, and press 'exit' to end the connect.

5.在开发板中输入字符,可在虚拟机中接收到:
You can enter string, and press 'exit' to end the connect.
www.myzr.com
OK: Sent 12 bytes sucessful, please enter again.








欢迎光临 明远智睿技术论坛 (http://bbs.myzr.com.cn/) Powered by Discuz! X3.2