Giter VIP home page Giter VIP logo

hotspotsocket's Introduction

安卓实现热点传输消息与文件

概述

HotSpotSocket是一个运行在Android系统上的应用,实现的功能有:创建热点、关闭热点、打开wifi、关闭wifi、发送接收消息、发送接收文件。

文件传输基本思路

两台手机首先通过一台手机打开热点,另一台连接其热点建立连接。连接之后,两台手机都能得到对方的ip地址,再约定好一个端口号就能建立socket连接。建立socket连接之后,就能通过相应的函数实现文件传输。

文件传输执行流程

  • 程序启动之后,启动一个子线程监听9999端口。
  • 当发送端点击“发送文件”按钮之后,选择需要发送的文件。选择文件功能通过NoNonsense-FilePicker库实现。
  • 发送端获得与其连接的设备的局域网ip。并通过此ip以及9999端口建立socket连接,并开启传输文件线程。
  • 接收端一直都在监听9999端口,当有文件传过来时便建立连接自动接收文件。

hotspotsocket's People

Contributors

hahallo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.