实现了基本的socket通信(即两台设备,一台用作服务器,一台用作客户端),服务器进行监听,客户端发送加密数据到服务器,服务器进行解密得到明文。
注意:本项目中使用了ButterKnife及EventBus作为辅助工具,通信建立时默认网络正常(未做局域网网络环境检测),加密方式为AES加密
1.效果图:
(1)客户端
(2)服务器端
2.界面布局部分
(1)服务器端布局 function_socket_server.xml
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
(2)客户端布局 function_socket_client.xml
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
(3)用到的style
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
3.功能代码
(1)基类 BaseEventActivity.Java
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
(2)服务器主界面 Function_Socket.java
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
Windows 7任务栏图标的功能问题解答
Windows 7任务栏图标的功能问题解答 Windows 7任务栏图标的功能小白与老牛,小白最近用上了新系统——Windows 7.Windows 7的桌面非(0)人阅读时间:2024-10-06Windows 7数据备份还原技术详细介绍
Windows 7数据备份还原技术详细介绍 曾几何时,NTFS分区格式让Ghost略显无奈,不过最新的Ghost已经支持了NTFS分区,但是在Windows 7(0)人阅读时间:2024-10-06windows 7接内外网出现冲突解决方法
windows 7接内外网出现冲突解决方法 Windows 7双网卡同时接内外网时, 会发生两个默认网关冲突的情况,导致两个网络都不能访问。 因此解决方法就是只(0)人阅读时间:2024-10-06如何使用五种windows密码设置(windows设置简单密码)
如何使用五种windows密码设置 我们在使用xp系统电脑的过程中,难免要与各类密码打交道,以下九种密码可能是大家用的最多的:BIOS密码、安装密码、用户密码、(0)人阅读时间:2024-10-06Windows 7数据备份还原技术详细介绍
Windows 7数据备份还原技术详细介绍 曾几何时,NTFS分区格式让Ghost略显无奈,不过最新的Ghost已经支持了NTFS分区,但是在Windows 7..2024-10-06Windows 8中Hyper-V虚拟机操作应用的具体步骤
Windows 8中Hyper-V虚拟机操作应用的具体步骤 微软将Hyper-V管理器集成到个人Windows 8系统中,可以说是一大改进。而这一改进也说明虚拟..2024-10-06windows无法连接到选定网络(windows无法连接到指定网络)
windows无法连接到选定网络 网络可能不在区域中解决方法 使用XP操作系统,搜索到无线路由器的无线信号很好,但是无线连接不上,并出现提示如下: 出现该问题的..2024-10-06Windows 7漫画专辑:拼合全景照片
Windows 7漫画专辑:拼合全景照片 Windows 7漫画专辑:拼合全景照片..2024-10-06