明远智睿技术论坛

 找回密码
 立即注册
搜索
查看: 2851|回复: 0
打印 上一主题 下一主题

imx8m使用TCP通信

[复制链接]

56

主题

60

帖子

644

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
644
跳转到指定楼层
楼主
发表于 2020-4-30 08:21:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
主机平台: UBUNTU14.04
硬件平台:明远智睿MY-IMX8M-EK300
内核版本 :linux-4.14.98
交叉编译链:
aarch64-linux-gnu
文件系统:fsl-image-validation-myimx8m.tar.bz2


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


编译:
1.设置交叉编译工具:
$ source /home/myzr/my-work/imx8m/03_toolchain/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.env


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.

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|明远智睿  

GMT+8, 2024-4-29 01:24 , Processed in 0.063806 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表