CN108429751A - File transfer control method, device and computer readable storage medium, terminal - Google Patents
File transfer control method, device and computer readable storage medium, terminal Download PDFInfo
- Publication number
- CN108429751A CN108429751A CN201810214442.4A CN201810214442A CN108429751A CN 108429751 A CN108429751 A CN 108429751A CN 201810214442 A CN201810214442 A CN 201810214442A CN 108429751 A CN108429751 A CN 108429751A
- Authority
- CN
- China
- Prior art keywords
- terminal
- socket
- file
- groups
- transmission
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1044—Group management mechanisms
- H04L67/1046—Joining mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
- H04L69/161—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
- H04L69/162—Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
Abstract
The present invention relates to file transmission fields, and in particular to a kind of file transfer control method, device and computer readable storage medium, terminal, the method includes:First terminal android system configuration information is obtained, and judges whether first terminal android system supports WIFIP2P patterns according to the configuration information;If supporting, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create Socket service receiving terminal and wait for second terminal Socket connections;If not supporting, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect the server hot spot, and created Socket service receiving terminal and wait for second terminal Socket connections;Socket is established with the second terminal to connect, file is transmitted based on Socket transmission channels and the second terminal when the first terminal.The present invention realizes efficient near field transmission file by using the double mode of WIFI P2P and WIFI hot spot.
Description
Technical field
The present invention relates to file transmission fields, and in particular to a kind of file transfer control method, device and computer-readable
Storage medium, terminal.
Background technology
In the epoch of nowadays information shared resources, user is intended to can be by short, adaptable and fast mode by oneself relevant money
Source is shared with the people of surrounding, but is not very cheap epoch just at a mobile data traffic, therefore shares in the presence of very big
Flow restriction.And it is very slow by the Internet transmission speed, and can be not suitable for doing big file biography by great flow restriction
It is defeated;Even if there is Bluetooth transmission, the technologies such as NFC transmission are emerged in large numbers, but the two transmission range and speed are all to significantly limit point
The spatial dimension of transmission is enjoyed, therefore can not be used on a large scale.And current solution is close to do based on WIFI in the industry
Field transmission is all to create a LAN WIFI hot spot by reflecting the hiding API of android system, other equipment is allowed to connect,
In this, as the capital construction of communication, it will appear not expected adaptation issues in the iteration of terminal system version in this way, and reflect
Itself is a unstable modes for API Calls, thus how in all platforms of compatible Android, without too many adaptation
Under the premise of work, ensure the problem of stability, the timeliness of near field transmission file are current urgent need to resolve.
Invention content
To overcome the above technical problem, the especially prior art that the equipment under Android platform can not simply be allowed to carry out
The problem of efficient near field transmission file, spy propose following technical scheme:
In a first aspect, the present invention provides a kind of file transfer control methods, including:
First terminal android system configuration information is obtained, and first terminal Android is judged according to the configuration information
Whether system supports WIFI P2P patterns;
If supporting, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create Socket
It services receiving terminal and waits for second terminal Socket connections;
If not supporting, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect the clothes
Business device hot spot, and create Socket service receiving terminal and wait for second terminal Socket connections;
Socket is established with the second terminal to connect, transmission channel and institute are read based on Socket when the first terminal
State second terminal transmission file.
Further, described to create P2P groups in first terminal, including:
P2P groups are created in first terminal and configure first terminal to P2P groups group leader;
After the P2P groups that the second terminal is added that first terminal creates, if detecting, second terminal request becomes
P2P groups group leader, then it is P2P groups group member to configure first terminal.
Further, described to wait for second terminal that the P2P groups are added in first terminal establishment P2P groups, and create
After Socket service receiving terminal waits for second terminal Socket connections, further include:
If first terminal and the Socket of second terminal connections are interrupted, server is created according to WIFI hot spot pattern
Hot spot continues to establish connection with second terminal.
Further, if the first terminal and the Socket of second terminal connections are interrupted, according to WIFI hot spot
Pattern creates server hot spot, continues after establishing connection with second terminal, further includes:
When detecting that first terminal meets preset condition, P2P groups are re-created in first terminal, are continued with second eventually
Connection is established at end.
Further, described that file is transmitted based on Socket transmission channels and the second terminal, including:Read local
The preset value of Socket buffering areas, the preset value based on the Socket buffering areas transmit file with the second terminal;It is described
Method further includes:
The configuration file for receiving the preset value for the Socket buffering areas that server issues updates this according to the configuration file
The preset value of the Socket buffering areas on ground.
Further, described to establish Socket with the second terminal when the first terminal and connect, it is passed based on Socket
Defeated channel further includes with after second terminal transmission file:
Confirm that the first terminal completes file transmission with second terminal file, by the file of first terminal and second terminal
Transmission information is uploaded onto the server, to allow the default of update Socket buffering areas after file transmission information described in server statistics
Value;The file transmission information includes file transmission time, transmission file size, file transfer rate, file transmission success rate
And mortality.
In combination, the present invention also provides a kind of file transfer control methods for multiterminal, including:
First terminal obtains android system configuration information, and judges first terminal Android according to the configuration information
Whether system supports WIFI P2P patterns;If supporting, first terminal creates P2P groups and waits for second terminal that the P2P groups are added,
And it creates Socket service receiving terminal and waits for second terminal Socket connections;If not supporting, first terminal is according to WIFI hot spot
Pattern creates server hot spot and second terminal is waited for connect the server hot spot, and creates Socket service receiving terminal and wait for the
Two terminal Socket connections;
Second terminal obtains android system configuration information, and preferentially setting WIFI P2P pattern applications are added first eventually
The P2P groups created are held, then apply connecting the service that first terminal creates when second terminal can not be added to the P2P groups
Device hot spot;
First terminal is established Socket with second terminal and is connect, and transmits file based on Socket transmission channels.
Further, after the P2P groups that the first terminal creates are added in shown second terminal, further include:
According to User Defined, configures the second terminal to P2P groups group leader, configure the first terminal to
P2P groups group member.
Second aspect, the present invention also provides a kind of file transmission control units, including:
Judgment module:Judge for obtaining first terminal android system configuration information, and according to the configuration information
Whether one terminal android system supports WIFI P2P patterns;
First execution module:Judge that first terminal android system supports WIFI P2P moulds for working as the judgment module
When formula, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create Socket service receiving terminal
Wait for second terminal Socket connections;
Second execution module:Judge that first terminal android system does not support WIFI P2P for working as the judgment module
When pattern, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect the server hot spot,
And it creates Socket service receiving terminal and waits for second terminal Socket connections;
Document transmission module:Socket is established with the second terminal to connect, passed based on Socket when the first terminal
File is transmitted with the second terminal in defeated channel.
The third aspect, the present invention also provides a kind of computer readable storage medium, the computer readable storage medium
On be stored with computer program, which realizes above-mentioned file transfer control method when being executed by processor.
Fourth aspect, the present invention also provides a kind of terminal, the terminal include one or more processors, memory,
One or more application program, wherein one or more of application programs be stored in the memory and be configured as by
One or more of processors execute, and one or more of programs are configured to carry out above-mentioned file transmission controlling party
Method.
Compared with prior art, the present invention having the advantages that:
The present invention is by obtaining terminal android system configuration information, according to system own configuration information different
The interface channel that different construction of strategy bottoms is used in android system does not have to consider transmission underlying protocol, is without consideration
The no Android versions for supporting complete set, the robustness of interface channel is ensure that using the double mode of WIFI P2P and WIFI hot spot,
All platforms of compatible Android are can guarantee under the protection of this double mode, and android system complexity is alleviated for developer
Adaptation work has greatly been adapted to the terminal of android system to user, after building LAN, place LAN
Interior mobile phone can be completed to communicate between each other, and use the optimization transport protocol based on Socket, greatly ensure text
The transmission speed of part realizes efficient near field transmission file.
In addition, the present invention is also dynamically adapted the Role composition of terminal in P2P groups, by first terminal by P2P groups group
Length is configured to P2P groups group member role, converts second terminal to P2P groups group leader role by P2P groups group member, ensures first
File can be efficiently transmitted between terminal, second terminal mutually.
Furthermore file transmission information is also uploaded to given server by the present invention, obtained more preferably by server statistics
The preset value of Socket buffering areas is simultaneously handed down to terminal, and terminal is just dynamically adapted the preset value of Socket buffering areas with preferably
Improve file transmission efficiency, file transmission success rate.
The additional aspect of the present invention and advantage will be set forth in part in the description, these will become from the following description
Obviously, or practice through the invention is recognized.
Description of the drawings
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments
Obviously and it is readily appreciated that, wherein:
Fig. 1 is an embodiment flow diagram of file transfer control method of the present invention;
Fig. 2 is another embodiment flow diagram of file transfer control method of the present invention;
Fig. 3 is another embodiment flow diagram of file transfer control method of the present invention;
Fig. 4 is an embodiment schematic diagram of file transmission control unit of the present invention;
Fig. 5 is an example structure schematic diagram of terminal of the present invention.
Specific implementation mode
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end
Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached
The embodiment of figure description is exemplary, and is only used for explaining the present invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singulative " one " used herein, " one
It is a ", " described " and "the" may also comprise plural form.It is to be further understood that is used in the specification of the present invention arranges
Diction " comprising " refer to there are the feature, integer, step, operation, but it is not excluded that presence or addition it is one or more other
Feature, integer, step, operation.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art
Language and scientific terminology), there is meaning identical with the general understanding of the those of ordinary skill in fields of the present invention.Should also
Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art
The consistent meaning of meaning, and unless by specific definitions as here, the meaning of idealization or too formal otherwise will not be used
To explain.
It will be appreciated by those skilled in the art that so-called " application " of the invention, " application program ", " application software ", " client
The concept at end ", " client software " and similar statement, is the same concept well known to those skilled in the art, refers to by a system
Column count machine instructs and the computer software for being suitable for electronics operation of the organic construction of related data resource.Unless specified, this
Not by programming language type, rank, the operating system of operation of also not rely by it or platform are limited for kind name itself.Reason is worked as
So, this genus is not also limited by any type of terminal.
It can be used in intelligence it will be appreciated by those skilled in the art that the so-called user interface of the present invention, display interface refer to
Energy terminal sends the display interface of the control instruction, for example, it may be Android/IOS/Windows Phone systems are set
The option (or button, wherein by application program addition, similarly hereinafter) in the page is set, can also be leading to of breathe out from desktop
Know an option in column or interaction page, can also be in the page that a movable component of the application program is constructed
An option.
WIFI P2P patterns:WiFi equities API (P2P) need not be connected to network or hot spot, and (P2P frames meet WiFi volumes
Journey instructs specification), allow for application program to be connected to neighbouring equipment.
Reflect Api:The method being hidden is called by the mechanism of java reflections, there is certain danger.
Service:One of four big component of android system can remain operational from the background.
Socket:Socket, the transmission module based on the encapsulation of TCP/IP transport protocols that java frames provide.
In one embodiment, the present invention provides a kind of file transfer control method, as shown in Figure 1, this method includes:
S100:First terminal android system configuration information is obtained, and first terminal is judged according to the configuration information
Whether android system supports WIFI P2P patterns.
The executive agent of the present embodiment is the WIFI P2P being integrated in Android and the application journey of WIFI module function
Sequence, application program installation operate in first terminal and second terminal, first terminal in the present embodiment, second terminal number
Amount is not construed as limiting, and is understood for convenience and is described, is illustrated by taking a first terminal and a second terminal as an example.When first
When carrying out the transmission of file between terminal and second terminal, share, start the application in first terminal, second terminal
Program is set out with single-ended angle, is installed, is operated in application program on first terminal and obtain first terminal android system
WIFI P2P technologies are encapsulated and are broadcasted by configuration information, android system, and the application program in the present embodiment is by creating one
Radio receiver, which intercepts corresponding system broadcasts, can get the configuration information, then pass through
WifiManger.isP2pSupport () judges whether first terminal system supports WIFI P2P patterns.
S200:If supporting, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create
Socket service receiving terminal waits for second terminal Socket connections.
If having judged, first terminal system supports WIFI P2P patterns, the application program of the present embodiment according to
WifiP2pManager.createGroup () creates P2P groups in first terminal, while configuring first terminal as P2P groups
Group group leader (or being administrator), Socket service receiving terminal is created on first terminal and opens corresponding backstage Service,
A service thread is created simultaneously to monitor the connection request of second terminal, and obstruction waits for second terminal Socket connections.
S300:If not supporting, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect
The server hot spot is connect, and creates Socket service receiving terminal and waits for second terminal Socket connections.
If having judged, first terminal system does not support WIFI P2P patterns, and the application program of the present embodiment is according to Android
The WIFI hot spot pattern of system creates server hot spot using WifiManager.addNetwork () in first terminal, waits for
Second terminal connects the server hot spot, while building server-side using new ServerSocket (port) on first terminal
Socket Server, and corresponding backstage Service is opened, wait for second terminal Socket connections.
S400:Socket is established with the second terminal when the first terminal to connect, based on Socket transmission channels with
The second terminal transmits file.
After first terminal establishes Socket with second terminal to be connect, file path need to be only passed to by file sender,
And file reception side needs to define file storing path in advance, it is preferred that the file storing path of the present embodiment is fixed in advance
Justice is good and can voluntarily be changed by user, and then file can be passed to the file that file reception side defines and protected by file sender
It deposits under path, is a preset value such as 512K by Socket setting buffers in the present embodiment, then first terminal and second terminal
File transmission is completed by the channels Socket based on the preset value, such as first terminal is successively read file stream based on the preset value
Enter in Socket transmission channels, then file stream is written successively from Socket transmission channels based on the preset value again for second terminal
To file in.
The present embodiment is by obtaining terminal android system configuration information, according to system own configuration information different
The interface channel that different construction of strategy bottoms is used in android system does not have to consider transmission underlying protocol, is without consideration
The no Android versions for supporting complete set, the robustness of interface channel is ensure that using the double mode of WIFI P2P and WIFI hot spot,
All platforms of compatible Android are can guarantee under the protection of this double mode, and android system complexity is alleviated for developer
Adaptation work has greatly been adapted to the terminal of android system to user, after building LAN, place LAN
Interior mobile phone can be completed to communicate between each other, and use the optimization transport protocol based on Socket, greatly ensure text
The transmission speed of part realizes efficient near field transmission file.
It is described to create P2P groups in first terminal in the embodiment of the present invention, including:
P2P groups are created in first terminal and configure first terminal to P2P groups group leader;
After the P2P groups that the second terminal is added that first terminal creates, further include:
If detecting, second terminal request becomes P2P groups group leader, and it is P2P groups group member to configure first terminal.
In the present embodiment, application program configures first terminal to P2P groups group when first terminal creates P2P groups
Long, application program runs the task of P2P group group leaders in first terminal at this time, monitors the addition of the second terminal P2P groups
Request, further, second terminal be added first terminal create P2P groups after, if detect second terminal request at
For P2P groups group leader, then it is P2P groups group member to configure first terminal, the task of the P2P group group members of first terminal operation at this time,
To the file that P2P groups group leader (i.e. second terminal) sends request, reception second terminal is sent.
As shown in Fig. 2, a kind of embodiment of the present invention, described to wait for second terminal to add in first terminal establishment P2P groups
Enter the P2P groups, and create Socket service receiving terminal wait for second terminal Socket connections after, further include:
S210:If first terminal and the Socket of second terminal connections are interrupted, created according to WIFI hot spot pattern
Server hot spot continues to establish connection with second terminal.
In the present embodiment, breakpoint transmission and multifile simultaneous transmission are supported in the file transmission, when first terminal creates P2P
Group, the P2P groups are added in second terminal and first terminal establishes Socket with second terminal and connect transmission file, in file
In transmission process, first terminal caused for some reason is connect with second terminal based on the Socket under WIFI P2P patterns
It interrupts, then first terminal switching uses WIFI hot spot mode construction server hot spot, second terminal to connect server heat
Point, continue keep first terminal and second terminal connection, while according to file transmit breakpoint transmission the characteristics of, from first terminal
Document transmission progress when connection with second terminal is interrupted continues file transmission, ensures the effective of file transmission
Property, improve the efficiency of file transmission.
Further, in the embodiment, if during the Socket connections of the S210 first terminals and second terminal occur
It is disconnected, then server hot spot is created according to WIFI hot spot pattern, continues after establishing connection with second terminal, further include:
S211:When detecting that first terminal meets preset condition, P2P groups are re-created in first terminal, continue with
Second terminal establishes connection.
Caused first terminal is connect with the Socket of second terminal interruption P2P groups for some reason, in above-mentioned reality
First terminal in example is applied to be switched to using WIFI hot spot pattern establishment server hot spot and continue to establish connection with second terminal, and
In view of WIFI P2P patterns file laser propagation effect more preferably, when application program detects that first terminal meets preset condition,
Confirm that first terminal can reuse WIFI P2P patterns at this time, then re-create P2P groups, second terminal in first terminal
The P2P groups are rejoined, continue that first terminal is kept to connect with second terminal, likewise, transmitting breakpoint transmission according to file
The characteristics of, document transmission progress when re-creating P2P groups from first terminal continues file transmission, ensures file transmission
Validity, improve file transmission efficiency.
A kind of embodiment of the present invention, it is described that file is transmitted based on Socket transmission channels and the second terminal, including:
The preset value for reading local Socket buffering areas, the preset value based on the Socket buffering areas are transmitted with the second terminal
File;The method further includes:
The configuration file for receiving the preset value for the Socket buffering areas that server issues updates this according to the configuration file
The preset value of the Socket buffer sizes on ground.
In the present embodiment, server can periodically update the preset value of Socket buffering areas, in order to which application program can match
The preset value of more preferably Socket buffering areas is set, application program can receive the Socket buffering areas that server issues in networking
Preset value configuration file, and application program receives the behavior of configuration file that server issues and is not happened at first terminal
During connection being established with second terminal, it is preferred that the present embodiment is received under server when opening application program
The configuration file of hair and the preset value for updating local Socket buffering areas ensure to count newest on server with this
The preset value of Socket buffering areas, to provide better file transmission efficiency.
As shown in figure 3, a kind of embodiment of the present invention, described when the first terminal and the second terminal are established
Socket connections are based on Socket transmission channels with after second terminal transmission file, further include:
S500:Confirm that the first terminal completes file transmission with the second terminal, by first terminal and second terminal
File transmission information upload onto the server, to allow update Socket buffering areas after file transmission information described in server statistics
Preset value.
In the present embodiment, after completing file transmission each time, the first terminal of file transmission will be literary with second terminal
Part transmission information uploads to given server, and the file transmission information includes file transmission time, transmission file size, file
Then transmission rate, file transmission success rate and mortality, those file transmission informations of server statistics judge that file passes with this
Defeated concrete condition is wanted according to whether the preset value of analysis of statistical data Socket buffering areas at this time reaches preset file transmission
It asks, if analysis is obtained with the more preferably preset value of Socket buffering areas, server issues Socket buffering areas to terminal
Preset value configuration file, after terminal receives the configuration file, you can local according to configuration file update
The preset value of Socket buffering areas, to improve file transmission efficiency and success rate.
In another embodiment, the present invention is based on the angles that first terminal is combined with second terminal to provide a kind of file biography
Transmission control method, including:
First terminal obtains android system configuration information, and judges first terminal Android according to the configuration information
Whether system supports WIFI P2P patterns;If supporting, first terminal creates P2P groups and waits for second terminal that the P2P groups are added,
And it creates Socket service receiving terminal and waits for second terminal Socket connections;If not supporting, first terminal is according to WIFI hot spot
Pattern creates server hot spot and second terminal is waited for connect the server hot spot, and creates Socket service receiving terminal and wait for the
Two terminal Socket connections;
Second terminal obtains android system configuration information, and preferentially setting WIFI P2P pattern applications are added first eventually
The P2P groups created are held, then apply connecting the service that first terminal creates when second terminal can not be added to the P2P groups
Device hot spot;
First terminal is established Socket with second terminal and is connect, and transmits text based on the preset value of Socket transmission channels
Part.
The executive agent of the present embodiment is the WIFI P2P being integrated in Android and the application journey of WIFI module function
Sequence, application program installation operate in first terminal and second terminal, when will be into style of writing between first terminal and second terminal
The transmission of part when sharing, starts the application program in first terminal, second terminal, installs, operates on first terminal
Application program obtain first terminal android system configuration information, passed through according to the configuration information
WifiManger.isP2pSupport () judges whether first terminal android system supports WIFI P2P patterns, if judging
First terminal android system supports WIFI P2P patterns, and application program is according to WifiP2pManager.createGroup
() creates P2P groups in first terminal, while configuring first terminal as P2P groups group leader (or being administrator), first
Socket service receiving terminal is created in terminal and opens corresponding backstage Service, while creating a service thread to monitor
The connection request of second terminal, obstruction wait for second terminal Socket connections.If having judged, first terminal android system is not propped up
WIFI P2P patterns are held, application program is utilized according to the WIFI hot spot pattern of android system
WifiManager.addNetwork () creates server hot spot in first terminal, and second terminal is waited for connect server heat
Point, while server-side Socket Server are built using new ServerSocket (port) on first terminal, and open phase
The backstage Service answered waits for second terminal Socket connections.
Corresponding, second terminal obtains android system configuration information, and preferentially setting WIFI P2P pattern applications are added
The P2P groups that first terminal creates, when first terminal, second terminal support WIFI P2P patterns, then second terminal is added
The P2P groups that first terminal creates, and when second terminal can not be added to the P2P groups, eventually such as first terminal or second
WIFI P2P patterns are not supported at end, then the server hot spot that second terminal application connection first terminal creates, second terminal connection
After the WIFI hot spot created to first terminal or addition P2P groups and channel successful connection, creates client Socket and pass through
TCP communication is established with server-side (first terminal), is preset value by Socket setting buffers, and be based on Socket transmission channels
Preset value transmit file.
Further, in the present embodiment, after the P2P groups that the first terminal creates are added in shown second terminal,
Further include:
According to User Defined, configures the second terminal to P2P groups group leader, configure the first terminal to
P2P groups group member.
In the present embodiment, application program configures first terminal to P2P groups group when first terminal creates P2P groups
Long, application program runs the task of P2P group group leaders in first terminal at this time, monitors the addition of the second terminal P2P groups
Request, further, second terminal be added first terminal create P2P groups after, if detect second terminal request at
For P2P groups group leader, then it is P2P groups group member to configure first terminal, the task of the P2P group group members of first terminal operation at this time,
To the file that P2P groups group leader (i.e. second terminal) sends request, reception second terminal is sent.
In another embodiment, as shown in figure 4, the present invention provides a kind of file transmission control units, including:
Judgment module 100:Sentence for obtaining first terminal android system configuration information, and according to the configuration information
Whether disconnected first terminal android system supports WIFI P2P patterns;
First execution module 200:Judge that first terminal android system supports WIFI P2P for working as the judgment module
When pattern, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create Socket service reception
End waits for second terminal Socket connections;
Second execution module 300:Judge that first terminal android system does not support WIFI for working as the judgment module
When P2P patterns, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect server heat
Point, and create Socket service receiving terminal and wait for second terminal Socket connections;
Document transmission module 400:Socket is established with the second terminal to connect, be based on Socket when the first terminal
Transmission channel transmits file with the second terminal.
Judgment module 100 intercepts first terminal android system broadcast acquisition first by creating a radio receiver
Then the configuration information of terminal android system judges first terminal system by WifiManger.isP2pSupport ()
Whether WIFI P2P pattern is supported.
When the judgment module 100 judges that first terminal android system supports WIFI P2P patterns, first executes mould
Block 200 creates P2P groups in first terminal, while configuring first terminal as P2P groups group leader (or for administrator),
Socket service receiving terminal is created on first terminal and opens corresponding backstage Service, while being created a service thread and being come
The connection request of second terminal is monitored, obstruction waits for second terminal Socket connections.
When the judgment module judges that first terminal android system does not support WIFI P2P patterns, second executes mould
Block 300 is created using WifiManager.addNetwork () in first terminal according to the WIFI hot spot pattern of android system
Server hot spot waits for second terminal to connect the server hot spot, while utilizing new ServerSocket on first terminal
(port) server-side Socket Server are built, and open corresponding backstage Service, wait for second terminal Socket connections.
After first terminal establishes Socket with second terminal to be connect, document transmission module 400 is transmitted based on Socket
File is transmitted with the second terminal in channel.
In another embodiment, the present invention provides a kind of computer readable storage medium, computer-readable storage mediums
Computer program is stored in matter, which realizes the direct broadcasting room action message exhibition described in above-described embodiment when being executed by processor
Show method.Wherein, the computer readable storage medium includes but not limited to any kind of disk (including floppy disk, hard disk, light
Disk, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS
Memory, immediately memory), EPROM (EraSable Programmable Read-Only Memory, erasable programmable
Read-only memory), EEPROM (Electrically EraSable Programmable Read-Only Memory, electrically erasable
Programmable read only memory), flash memory, magnetic card or light card.It is, storage device include by equipment (for example, calculate
Machine, mobile phone) any medium of storage or transmission information in the form of it can read can be read-only memory, disk or CD etc..
A kind of computer readable storage medium provided in an embodiment of the present invention is, it can be achieved that include:Obtain first terminal
Android system configuration information, and judge whether first terminal system supports WIFI P2P patterns according to the configuration information;If
It supports, creating P2P groups in first terminal waits for second terminal that the P2P groups are added, and creates Socket service receiving terminal
Wait for second terminal Socket connections;If not supporting, server hot spot is created in first terminal according to WIFI hot spot pattern and is waited for
Second terminal connects the server hot spot, and creates Socket service receiving terminal and wait for second terminal Socket connections;Work as institute
It states first terminal and establishes Socket with the second terminal and connect, based on Socket transmission channels and second terminal transmission text
Part.By obtaining terminal android system configuration information, according to system own configuration information in different android systems
Using the interface channel of different construction of strategy bottoms, do not have to consider transmission underlying protocol, complete set is supported without considering whether
Android versions ensure that the robustness of interface channel using the double mode of WIFI P2P and WIFI hot spot, be protected in this double mode
It can guarantee all platforms of compatible Android under shield, the adaptation work of android system complexity alleviated for developer, it is right
User has greatly been adapted to the terminal of android system, and after building LAN, the mobile phone in the LAN of place is just
It can complete to communicate between each other, and use the optimization transport protocol based on Socket, greatly ensure the transmission speed of file
Degree, realizes efficient near field transmission file.It is adjusted in addition, computer readable storage medium provided by the invention can also be achieved dynamic
The Role composition of terminal in whole P2P groups configures first terminal to P2P groups group member role, by second by P2P groups group leader
Terminal is converted into P2P groups group leader role by P2P groups group member, and ensureing can efficiently mutually between first terminal, second terminal
Mutually transmission file.In addition, computer readable storage medium provided by the invention can also be achieved uploads to finger by file transmission information
Determine server, the more preferably preset value of Socket buffering areas is obtained by server statistics and be handed down to terminal, terminal can dynamic
The preset value of Socket buffering areas is adjusted preferably to improve file transmission efficiency, file transmission success rate.
The reality of above-mentioned file transfer control method may be implemented in computer readable storage medium provided in an embodiment of the present invention
Example is applied, concrete function realizes the explanation referred in embodiment of the method, and details are not described herein.
In addition, in another embodiment, the present invention also provides a kind of terminals, as shown in figure 5, the terminal may include
One or more than one processor 501 further include memory 502, WiFi (wireless fidelity, Wireless Fidelity)
It is circuit 503, RF (Radio Frequency, radio frequency) circuit 504, voicefrequency circuit 505, sensor 506, output equipment 507, defeated
Enter equipment 508, power supply 509, processor 501 is the control centre of terminal, utilizes various interfaces and the above each section of connection.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Fig. 5, may include than diagram
More or fewer components either combine certain components or different components arrangement.
WiFi circuitry 503 can provide WLAN or internet access to the user;It may include antenna, WiFi module
Deng.RF circuits 504 can receive and send messages, or signal sends and receivees in communication process;It may include antenna, at least one puts
Big device, tuner, one or more oscillators, coupler, duplexer etc..The audio data that voicefrequency circuit 505 can will receive
It is converted into electric signal, is transferred to loud speaker, also the voice signal that microphone is collected audio data can be converted to, issue processor
501 processing;Loud speaker, microphone, earphone interface etc. can be arranged in it.Sensor 506 can be used for incuding outer signals, and issue place
Device 501 is managed to handle;It may include motion sensor, optical sensor etc..Output equipment 507 can be used for showing various signals;It can
For using LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting
Diode, Organic Light Emitting Diode) etc. forms configure display panel.Input equipment 504 can be used for inputting the letters such as number and character
Breath;It can be physical button, touch panel etc..Power supply 509 can be that terminal each section is powered, and pass through power-supply management system and processing
509 logical connection of device;It may include one or more direct current or AC power, charging system, power supply status indicator
Equal components.Memory 502 can be used for storing software program and module;It can be computer readable storage medium, be specifically
Hard disk, flash memory etc..Processor is the control centre of terminal, by running or executing the software program being stored in memory 502
And/or module, and the data for being stored in memory 502 are called, execute terminal various functions, processing terminal data.
As one embodiment, terminal includes:One or more processors 501, memory 502, one or more application
Program, wherein one or more of application programs are stored in memory 502 and are configured as by one or more of
Processor 501 executes, and one or more of programs are configured to carry out the file transfer control method described in above example.
A kind of terminal provided in an embodiment of the present invention is, it can be achieved that obtain first terminal android system configuration information, and root
Judge whether first terminal system supports WIFI P2P patterns according to the configuration information;If supporting, P2P groups are created in first terminal
Group waits for second terminal that the P2P groups are added, and creates Socket service receiving terminal and wait for second terminal Socket connections;If
It does not support, creating server hot spot in first terminal according to WIFI hot spot pattern waits for second terminal to connect the server hot spot,
And it creates Socket service receiving terminal and waits for second terminal Socket connections;When the first terminal and the second terminal are built
Vertical Socket connections transmit file based on Socket transmission channels and the second terminal.By obtaining terminal android system
Configuration information uses the company of different construction of strategy bottoms according to system own configuration information in different android systems
Connect road, do not have to consider transmission underlying protocol, without considering whether to support the Android versions of complete set, using WIFI P2P and
The double mode of WIFI hot spot ensure that the robustness of interface channel, can guarantee that compatible Android is all under the protection of this double mode
Platform alleviates the adaptation work of android system complexity for developer, to user, is greatly adapted to
The terminal of android system, after building LAN, the mobile phone in the LAN of place can be completed to communicate between each other,
And the optimization transport protocol based on Socket is used, greatly ensures the transmission speed of file, efficient near field is realized and passes
Defeated file.In addition, terminal provided by the invention can also be achieved the Role composition of terminal in dynamic adjustment P2P groups, eventually by first
End is configured to P2P groups group member role by P2P groups group leader, converts second terminal to P2P groups group leader by P2P groups group member
Role ensures efficiently transmit file mutually between first terminal, second terminal.In addition, terminal provided by the invention is also
It can be achieved file transmission information uploading to given server, the default of more preferably Socket buffering areas obtained by server statistics
Be worth and be handed down to terminal, terminal be just dynamically adapted the preset value of Socket buffering areas with preferably improve file transmission efficiency,
File transmission success rate.
The embodiment of the file transfer control method of above-mentioned offer may be implemented in terminal provided in an embodiment of the present invention, specifically
Function realizes the explanation referred in embodiment of the method, and details are not described herein.
The above is only some embodiments of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.
Claims (11)
1. a kind of file transfer control method, which is characterized in that including:
First terminal android system configuration information is obtained, and first terminal android system is judged according to the configuration information
Whether WIFI P2P pattern is supported;
If supporting, creates P2P groups in first terminal and wait for second terminal that the P2P groups are added, and create Socket service
Receiving terminal waits for second terminal Socket connections;
If not supporting, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect the server
Hot spot, and create Socket service receiving terminal and wait for second terminal Socket connections;
Socket is established when the first terminal with the second terminal to connect, it is whole with described second based on Socket transmission channels
End transmission file.
2. according to the method described in claim 1, it is characterized in that, described create P2P groups in first terminal, including:
P2P groups are created in first terminal and configure first terminal to P2P groups group leader;
After the P2P groups that the second terminal is added that first terminal creates, if detecting, second terminal request becomes P2P groups
Group group leader, then it is P2P groups group member to configure first terminal.
3. according to the method described in claim 1, it is characterized in that, described create P2P groups waiting second eventually in first terminal
End be added the P2P groups, and create Socket service receiving terminal wait for second terminal Socket connections after, further include:
If first terminal and the Socket of second terminal connections are interrupted, server heat is created according to WIFI hot spot pattern
Point continues to establish connection with second terminal.
4. if according to the method described in claim 3, it is characterized in that, the first terminal and the Socket of second terminal connections
It interrupts, then server hot spot is created according to WIFI hot spot pattern, continue after establishing connection with second terminal, further include:
When detecting that first terminal meets preset condition, P2P groups are re-created in first terminal, continuation is built with second terminal
Vertical connection.
5. according to the method described in claim 1, it is characterized in that, described be based on Socket transmission channels and the second terminal
File is transmitted, including:Read the preset value of local Socket buffering areas, the preset value based on the Socket buffering areas and institute
State second terminal transmission file;
The method further includes:
The configuration file for receiving the preset value for the Socket buffering areas that server issues, local according to configuration file update
The preset value of Socket buffering areas.
6. according to the method described in claim 5, it is characterized in that, described when the first terminal and the second terminal are established
Socket connections are based on Socket transmission channels with after second terminal transmission file, further include:
Confirm that the first terminal completes file transmission with the second terminal, first terminal and the file of second terminal are transmitted
Information is uploaded onto the server, to allow after file transmission information described in server statistics the preset value for updating Socket buffering areas;Institute
It includes file transmission time, transmission file size, file transfer rate, file transmission success rate and failure to state file transmission information
Rate.
7. a kind of file transfer control method, which is characterized in that including:
First terminal obtains android system configuration information, and judges first terminal android system according to the configuration information
Whether WIFI P2P pattern is supported;If supporting, first terminal creates P2P groups and waits for second terminal that the P2P groups are added, and
It creates Socket service receiving terminal and waits for second terminal Socket connections;If not supporting, first terminal is according to WIFI hot spot pattern
Creating server hot spot waits for second terminal to connect the server hot spot, and creates Socket service receiving terminal waiting second eventually
Hold Socket connections;
Second terminal obtains android system configuration information, and preferentially first terminal wound is added in setting WIFI P2P pattern applications
The P2P groups built then apply connecting the server heat that first terminal creates when second terminal can not be added to the P2P groups
Point;
First terminal is established Socket with second terminal and is connect, and transmits file based on Socket transmission channels.
8. the method according to the description of claim 7 is characterized in that when shown second terminal is added what the first terminal created
After P2P groups, further include:
According to User Defined, it configures the second terminal to P2P groups group leader, the first terminal is configured to P2P groups
Group group member.
9. a kind of file transmission control unit, which is characterized in that including:
Judgment module:Judge first eventually for obtaining first terminal android system configuration information, and according to the configuration information
Whether end android system supports WIFI P2P patterns;
First execution module:For when the judgment module judge first terminal android system support WIFI P2P patterns when,
Creating P2P groups in first terminal waits for second terminal that the P2P groups are added, and creates Socket service receiving terminal and wait for the
Two terminal Socket connections;
Second execution module:Judge that first terminal android system does not support WIFI P2P patterns for working as the judgment module
When, server hot spot is created in first terminal according to WIFI hot spot pattern, second terminal is waited for connect the server hot spot, and
It creates Socket service receiving terminal and waits for second terminal Socket connections;
Document transmission module:Socket is established when the first terminal with the second terminal to connect, it is logical based on Socket transmission
File is transmitted with the second terminal in road.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium
Program realizes claim 1-6 or 7-8 any one of them file transfer control method when the program is executed by processor.
11. a kind of terminal, which is characterized in that including:
One or more processors;
Memory;
One or more application program, wherein one or more of application programs are stored in the memory and are configured
To be executed by one or more of processors, one or more of application programs are configured to carry out according to claim 1-
6 or 7-8 any one of them file transfer control methods.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810214442.4A CN108429751A (en) | 2018-03-15 | 2018-03-15 | File transfer control method, device and computer readable storage medium, terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810214442.4A CN108429751A (en) | 2018-03-15 | 2018-03-15 | File transfer control method, device and computer readable storage medium, terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108429751A true CN108429751A (en) | 2018-08-21 |
Family
ID=63158727
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810214442.4A Pending CN108429751A (en) | 2018-03-15 | 2018-03-15 | File transfer control method, device and computer readable storage medium, terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108429751A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111918414A (en) * | 2020-07-27 | 2020-11-10 | 深圳市亿道数码技术有限公司 | Wireless multiple redundant communication method based on android system |
CN111988287A (en) * | 2020-08-03 | 2020-11-24 | 支付宝(杭州)信息技术有限公司 | Data transmission method and device and electronic equipment |
CN112187726A (en) * | 2020-09-04 | 2021-01-05 | 宇龙计算机通信科技(深圳)有限公司 | Data transmission method, device, storage medium and terminal |
CN112688920A (en) * | 2020-12-09 | 2021-04-20 | 北京博瑞彤芸科技股份有限公司 | Method and system for judging authenticity of meeting event |
CN112713918A (en) * | 2020-12-23 | 2021-04-27 | 厦门市美亚柏科信息股份有限公司 | Method and system for extracting mobile phone data |
CN113765682A (en) * | 2021-09-13 | 2021-12-07 | 三星电子(中国)研发中心 | Method and system for performing group functions |
CN116055581A (en) * | 2022-11-23 | 2023-05-02 | 广东博力威科技股份有限公司 | Data transmission control method, device, equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110081923A1 (en) * | 2009-10-02 | 2011-04-07 | Babak Forutanpour | Device movement user interface gestures for file sharing functionality |
CN103561480A (en) * | 2013-10-21 | 2014-02-05 | 广东明创软件科技有限公司 | Data transmission method |
US20140351444A1 (en) * | 2013-05-22 | 2014-11-27 | Emily H. Qi | Systems and methods for enabling service interoperability functionality for wifi direct devices connected to a network via a wireless access point |
CN107018554A (en) * | 2017-03-07 | 2017-08-04 | 广东欧珀移动通信有限公司 | A kind of data transmission method, device and intelligent terminal |
-
2018
- 2018-03-15 CN CN201810214442.4A patent/CN108429751A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110081923A1 (en) * | 2009-10-02 | 2011-04-07 | Babak Forutanpour | Device movement user interface gestures for file sharing functionality |
US20140351444A1 (en) * | 2013-05-22 | 2014-11-27 | Emily H. Qi | Systems and methods for enabling service interoperability functionality for wifi direct devices connected to a network via a wireless access point |
CN103561480A (en) * | 2013-10-21 | 2014-02-05 | 广东明创软件科技有限公司 | Data transmission method |
CN107018554A (en) * | 2017-03-07 | 2017-08-04 | 广东欧珀移动通信有限公司 | A kind of data transmission method, device and intelligent terminal |
Non-Patent Citations (1)
Title |
---|
杨艾平: "基于Wi_Fi_Direct的Android文件传输研究与实现", 《中国优秀硕士学位论文全文数据库》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111918414A (en) * | 2020-07-27 | 2020-11-10 | 深圳市亿道数码技术有限公司 | Wireless multiple redundant communication method based on android system |
CN111988287A (en) * | 2020-08-03 | 2020-11-24 | 支付宝(杭州)信息技术有限公司 | Data transmission method and device and electronic equipment |
CN112187726A (en) * | 2020-09-04 | 2021-01-05 | 宇龙计算机通信科技(深圳)有限公司 | Data transmission method, device, storage medium and terminal |
CN112688920A (en) * | 2020-12-09 | 2021-04-20 | 北京博瑞彤芸科技股份有限公司 | Method and system for judging authenticity of meeting event |
CN112688920B (en) * | 2020-12-09 | 2021-09-21 | 北京博瑞彤芸科技股份有限公司 | Method and system for judging authenticity of meeting event |
CN112713918A (en) * | 2020-12-23 | 2021-04-27 | 厦门市美亚柏科信息股份有限公司 | Method and system for extracting mobile phone data |
CN113765682A (en) * | 2021-09-13 | 2021-12-07 | 三星电子(中国)研发中心 | Method and system for performing group functions |
CN116055581A (en) * | 2022-11-23 | 2023-05-02 | 广东博力威科技股份有限公司 | Data transmission control method, device, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108429751A (en) | File transfer control method, device and computer readable storage medium, terminal | |
US11012920B2 (en) | Wireless network host in silent mode | |
CN104301373B (en) | Via the synchronous sending out notice of file-sharing service | |
JP5081818B2 (en) | Multi-mode mobile device that automatically selects the radio access network interface during a service session | |
US20220417720A1 (en) | Electronic Subscriber Identity Module (eSIM) Management Platform | |
US20110294500A1 (en) | Power saving method of mobile device and communication system thereof | |
RU2009138333A (en) | SETTING A SAMPLE PHASE CONNECTION | |
WO2016112728A1 (en) | Data transmission method, network server, user terminal and system | |
US20120320886A1 (en) | Phone supporting mode conversion | |
BRPI0613037A2 (en) | system and method to update wireless applications | |
CN111371695B (en) | Service flow limiting method and device | |
JP2019068204A (en) | Communication apparatus and computer program for terminal device | |
CN102185925A (en) | System, terminal and method for supporting terminal data processing of computer | |
CN108370500B (en) | Optimized settings for wireless devices | |
US20160100021A1 (en) | Information processing device, destination information updating method, and record medium | |
WO2022116834A1 (en) | Method and apparatus for implementing data service in dual subscriber identity module mode, and mobile terminal | |
CN114867077A (en) | Multi-hop routing implementation method, device, equipment and storage medium | |
WO2006124927A2 (en) | Routing switch for parameterized routing in mesh networks | |
CN102752883A (en) | Communication system and communication method based on point-to-point network | |
JP2004229143A (en) | Communication system, data transmitting method, communication unit, program, and record medium | |
JP2013062670A (en) | Communication repeater and program to control communication repeater | |
Kogan | On porting iperf to Windows Mobile and adding Bluetooth support | |
US20230144568A1 (en) | Application-aware bgp path selection and forwarding | |
JP2016189617A (en) | Device and control method therefor, and program | |
KR101616057B1 (en) | Method for using a plurality of wireless networks selectively depending on communication state through intervention of a local relay and an apparatus for said method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20200420 Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province Applicant after: Alibaba (China) Co.,Ltd. Address before: 510640 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping square B radio tower 15 layer self unit 02 Applicant before: GUANGZHOU UC NETWORK TECHNOLOGY Co.,Ltd. |
|
TA01 | Transfer of patent application right | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180821 |
|
RJ01 | Rejection of invention patent application after publication |