CN111212151A - File transmission method, device and storage medium - Google Patents

File transmission method, device and storage medium Download PDF

Info

Publication number
CN111212151A
CN111212151A CN202010321336.3A CN202010321336A CN111212151A CN 111212151 A CN111212151 A CN 111212151A CN 202010321336 A CN202010321336 A CN 202010321336A CN 111212151 A CN111212151 A CN 111212151A
Authority
CN
China
Prior art keywords
vehicle monitoring
monitoring picture
ftp
server
message
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.)
Granted
Application number
CN202010321336.3A
Other languages
Chinese (zh)
Other versions
CN111212151B (en
Inventor
罗伦文
唐志斌
蔡青
吕琛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Zhongke Tongda High New Technology Co Ltd
Original Assignee
Wuhan Zhongke Tongda High New Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Zhongke Tongda High New Technology Co Ltd filed Critical Wuhan Zhongke Tongda High New Technology Co Ltd
Priority to CN202010321336.3A priority Critical patent/CN111212151B/en
Publication of CN111212151A publication Critical patent/CN111212151A/en
Application granted granted Critical
Publication of CN111212151B publication Critical patent/CN111212151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G08SIGNALLING
    • G08GTRAFFIC CONTROL SYSTEMS
    • G08G1/00Traffic control systems for road vehicles
    • G08G1/01Detecting movement of traffic to be counted or controlled
    • G08G1/017Detecting movement of traffic to be counted or controlled identifying vehicles
    • G08G1/0175Detecting movement of traffic to be counted or controlled identifying vehicles by photographing vehicles, e.g. when violating traffic rules
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Abstract

The embodiment of the application discloses a file transmission method, a file transmission device and a storage medium, wherein the file transmission method comprises the following steps: when a user uploads a vehicle monitoring picture through an FTP client, a first connection request of the FTP client is obtained; establishing connection with the FTP client according to the first connection request; acquiring a vehicle monitoring picture uploaded by a user from an FTP client, and writing the vehicle monitoring picture into a local disk; and determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture, and sending the message entity to a preset message queue in a message server so as to realize message notification of uploading the vehicle monitoring picture. The FTP server actively transmits the message entity containing the vehicle monitoring picture message to the message server, so that the message server does not need to scan the FTP server in real time, and when a large number of vehicle monitoring pictures are uploaded to the FTP server at the FTP client, the working efficiency of the urban road vehicle monitoring system can be greatly improved.

Description

File transmission method, device and storage medium
Technical Field
The present application relates to the field of file transmission technologies, and in particular, to a file transmission method, an apparatus, and a storage medium.
Background
In the urban road vehicle monitoring system, vehicles on the road need to be captured by a camera to obtain a picture containing vehicle information, and the picture is transmitted back to a background of the urban road vehicle monitoring system, so that the urban road vehicle monitoring system can store or further process the picture.
In the prior art, an FTP service is generally established in an urban road vehicle monitoring system, an FTP client (camera) uploads a picture captured at a vehicle gate to an FTP server (background) through an FTP protocol, and a message server monitors or scans the FTP server in real time to acquire the change condition of the picture in the FTP server.
Because the message server needs to scan the FTP server in real time, the image transmission mode can only be suitable for small amount of low-frequency image transmission, and when the traffic flow at the vehicle bayonet is large and the number of images uploaded to the FTP server by the FTP client is large, the message server can consume a large amount of time for scanning, thereby seriously affecting the working efficiency of the urban road vehicle monitoring system.
Disclosure of Invention
The embodiment of the application provides a file transmission method, a file transmission device and a storage medium, and aims to improve the file transmission method and improve the working efficiency of an urban road vehicle monitoring system during transmission of a large number of vehicles.
The embodiment of the application provides a file transmission method, which is applied to an FTP server, wherein the FTP server is positioned in a city road vehicle monitoring system, the city road vehicle monitoring system further comprises an FTP client used for uploading vehicle monitoring pictures snap-shot by a camera from a vehicle gate and a message server used for receiving the vehicle monitoring pictures, and the method comprises the following steps:
when a user uploads the vehicle monitoring picture through the FTP client, a first connection request of the FTP client is obtained;
establishing connection with the FTP client according to the first connection request;
acquiring the vehicle monitoring picture uploaded by a user from the FTP client, and writing the vehicle monitoring picture into a local disk;
determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
sending a second connection request to the message server to establish a connection with the message server;
if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture;
if the connection establishment with the message server fails, circularly sending the second connection request;
if the cycle times reach a preset threshold value, the message entity is persisted in a local disk;
the message entity comprises an FTP protocol command currently executed by the FTP server, a file name of the vehicle monitoring picture, a file size of the vehicle monitoring picture, a file type of the vehicle monitoring picture, a file storage path of the vehicle monitoring picture, an FTP access path of the vehicle monitoring picture and an HTTP access path of the vehicle monitoring picture;
the file name of the vehicle monitoring picture comprises the equipment number of the camera, and the license plate number, the license plate color, the driving speed, the driving state and the passing time of the vehicle in the vehicle monitoring picture.
In some embodiments, said cyclically transmitting said second connection request comprises:
the second connection request is sent cyclically at increasing time intervals.
In some embodiments, if the connection with the message server is successfully established, the sending the message entity to a message queue preset in the message server to implement uploading of the message notification of the vehicle monitoring picture includes:
acquiring a value of a global connection state identifier IsConnected of the FTP server;
judging whether the connection with the message server is successfully established or not according to the IsConnected value;
and if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the message notification of uploading the vehicle monitoring picture.
In some embodiments, the determining, from the vehicle monitoring picture, a message entity identifying the vehicle monitoring picture information includes:
acquiring a currently executed FTP protocol command;
acquiring attributes of the vehicle monitoring picture, wherein the attributes of the vehicle monitoring picture comprise a file name, a file size, a file type and a file storage path of the vehicle monitoring picture;
acquiring an FTP access path of the vehicle monitoring picture;
acquiring an HTTP access path of the vehicle monitoring picture;
and generating the message entity according to the FTP protocol command, the attribute of the vehicle monitoring picture, the FTP access path and the HTTP access path.
In some embodiments, the obtaining the FTP access path of the vehicle monitoring picture includes:
acquiring an IP address and a port of the FTP server;
and splicing to generate an FTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture and the IP address and port of the FTP server.
In some embodiments, an HTTP service module is built in the FTP server, and the obtaining an HTTP access path of the vehicle monitoring picture includes:
acquiring an IP address of the FTP server;
acquiring a service port of the HTTP service module;
and splicing to generate an HTTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture, the IP address and the service port.
In some embodiments, the obtaining the vehicle monitoring picture from the FTP client and writing the vehicle monitoring picture to a local disk includes:
acquiring a type command and a mode command sent by the FTP client, wherein the type command is used for indicating the setting of the file transmission type of the FTP server, and the mode command is used for indicating the setting of the file transmission mode of the FTP server;
setting a file transmission type and a file transmission mode of the FTP server according to the type command and the mode command;
acquiring a pasv command sent by the FTP client, wherein the pasv command is used for indicating that the access mode of the FTP server is set to be a passive mode;
updating the access mode of the FTP server according to the pasv command;
acquiring a stor command which is sent by the FTP client and used for reminding the FTP server of receiving a vehicle monitoring picture;
determining the storage position of the vehicle monitoring picture in the local disk according to the stor command;
reading a file stream of the vehicle monitoring picture uploaded by the FTP client;
and obtaining the vehicle monitoring picture from the file stream, and writing the vehicle monitoring picture into a local disk.
The embodiment of the present application further provides a file transfer device, is applied to the FTP server, the FTP server is located urban road vehicle monitoring system, urban road vehicle monitoring system is still including the FTP client that is used for uploading the vehicle control picture that the camera was taken a candid photograph from the vehicle bayonet socket and being used for receiving the message server of vehicle control picture, file transfer device includes:
the first acquisition module is used for acquiring a first connection request of the FTP client when a user uploads the vehicle monitoring picture through the FTP client;
the first connection module is used for establishing connection with the FTP client according to the first connection request;
the file acquisition module is used for acquiring the vehicle monitoring picture uploaded by the user from the FTP client and writing the vehicle monitoring picture into a local disk;
the determining module is used for determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
the second connection module is used for sending a second connection request to the message server so as to establish connection with the message server;
the notification module is used for sending the message entity to a preset message queue in the message server if the connection with the message server is successfully established so as to realize the message notification of uploading the vehicle monitoring picture;
the circulating connection module is used for circularly sending the second connection request if the connection establishment with the message server fails;
and the storage module is used for persisting the message entity in a local disk if the cycle number reaches a preset threshold value.
In some embodiments, the loop connection module is configured to send the second connection request cyclically at increasing time intervals if the connection with the message server fails to be established;
the message entity comprises an FTP protocol command currently executed by the FTP server, a file name of the vehicle monitoring picture, a file size of the vehicle monitoring picture, a file type of the vehicle monitoring picture, a file storage path of the vehicle monitoring picture, an FTP access path of the vehicle monitoring picture and an HTTP access path of the vehicle monitoring picture;
the file name of the vehicle monitoring picture comprises the equipment number of the camera, and the license plate number, the license plate color, the driving speed, the driving state and the passing time of the vehicle in the vehicle monitoring picture.
In some embodiments, the notification module comprises:
a second obtaining module, configured to obtain a value of a global connection status identifier IsConnected of the FTP server;
the judging module is used for judging whether the connection with the message server is successfully established according to the IsConnected value;
and the sub-notification module is used for sending the message entity to a preset message queue in the message server if the connection with the message server is successfully established so as to realize the message notification of uploading the vehicle monitoring picture.
In some embodiments, the determining module comprises:
the first command acquisition module is used for acquiring the currently executed FTP protocol command;
the third acquisition module is used for acquiring the attributes of the vehicle monitoring picture, wherein the attributes of the vehicle monitoring picture comprise the file name, the file size, the file type and the file storage path of the vehicle monitoring picture;
the fourth acquisition module is used for acquiring an FTP access path of the vehicle monitoring picture;
the fifth acquisition module is used for acquiring an HTTP access path of the vehicle monitoring picture;
and the generating module is used for generating the message entity according to the FTP protocol command, the attribute of the vehicle monitoring picture, the FTP access path and the HTTP access path.
In some embodiments, the fourth obtaining module comprises:
the first sub-acquisition module is used for acquiring the IP address and the port of the FTP server;
and the first splicing module is used for splicing and generating an FTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture and the IP address and port of the FTP server.
In some embodiments, the fifth obtaining module comprises:
the second sub-acquisition module is used for acquiring the IP address of the FTP server;
the third sub-acquisition module is used for acquiring a service port of the HTTP service module;
and the second splicing module is used for splicing and generating the HTTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture, the IP address and the service port.
In some embodiments, the storage module comprises:
a second command acquisition module, configured to acquire a type command and a mode command sent by the FTP client, where the type command is used to instruct setting of a file transfer type of the FTP server, and the mode command is used to instruct setting of a file transfer mode of the FTP server;
the first setting module is used for setting the file transmission type and the file transmission mode of the FTP server according to the type command and the mode command;
a third command acquisition module, configured to acquire a pasv command sent by the FTP client, where the pasv command is used to indicate that an access mode of the FTP server is set as a passive mode;
the updating module is used for updating the access mode of the FTP server according to the pasv command;
the fourth command acquisition module is used for acquiring a stor command which is sent by the FTP client and used for reminding the FTP server of receiving the vehicle monitoring pictures;
the position determining module is used for determining the storage position of the vehicle monitoring picture in the local disk according to the stor command;
the reading module is used for reading the file stream of the vehicle monitoring picture uploaded by the FTP client;
and the writing module is used for obtaining the vehicle monitoring picture from the file stream and writing the vehicle monitoring picture into a local disk.
An embodiment of the present application further provides a server, where the server includes:
one or more processors;
a memory; and
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the file transfer method.
The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is loaded by a processor to execute the steps in the file transmission method.
The file transmission method provided by the embodiment of the application is mainly used for an FTP server, and comprises the steps of obtaining a first connection request of an FTP client, establishing connection with the FTP client according to the first connection request, obtaining a vehicle monitoring picture from the FTP client, writing the vehicle monitoring picture into a local disk, and determining a message entity for identifying information of the vehicle monitoring picture according to the vehicle monitoring picture; and then, sending a second connection request to the message server, if the connection with the message server is successful, sending a message entity to a message queue preset in the message server so as to realize the message notification of uploading the vehicle monitoring picture by the FTP client, wherein the message server can acquire the message of the vehicle monitoring picture in the FTP server in real time through the message entity without scanning the FTP server in real time, and when a large number of vehicle monitoring pictures are uploaded to the FTP server by the FTP client, the resource consumption of the urban road vehicle monitoring system can be reduced, and the working efficiency of the urban road vehicle monitoring system is greatly improved.
In addition, the file transmission method provided by the embodiment of the application also circularly sends the second connection request to the message server when the connection with the message server fails, and when the circulation times reach a preset threshold value, the message entity is persisted in the local disk, so that the message entity data of the vehicle monitoring picture in the FTP server is not lost under the condition that the message server is unavailable, the message entity is conveniently retransmitted after the connection with the message server is successful in the later period, the phenomenon that the transmission of the vehicle monitoring picture is unstable due to network faults is avoided, and the reliability of the transmission of the message entity of the urban road vehicle monitoring system is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic structural diagram of an embodiment of an urban road vehicle monitoring system provided by the embodiments of the present application;
fig. 2 is a schematic flowchart of an embodiment of a file transfer method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an embodiment of a document transmission device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an embodiment of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like indicate orientations or positional relationships based on those shown in the drawings, and are used merely for convenience of description and for simplicity of description, and do not indicate or imply that the referenced device or element must have a particular orientation, be constructed in a particular orientation, and be operated, and thus should not be considered as limiting the present application. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
In this application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the application. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known structures and processes are not set forth in detail in order to avoid obscuring the description of the present application with unnecessary detail. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
The embodiment of the application provides a file transmission method, a file transmission device and a storage medium. The following are detailed below.
Referring to fig. 1, fig. 1 is a schematic view of a scene of a system for monitoring urban road vehicles according to an embodiment of the present disclosure, where the system for monitoring urban road vehicles may include an FTP client 100, an FTP server 110 and a message server 120, the FTP server 110 is respectively connected to the FTP client 100 and the message server 120 via a network and integrated with a file transfer device in the FTP server 110, such as the system for monitoring urban road vehicles in fig. 1, and the FTP server 110 may respectively perform data interaction with the FTP client 100 and the message server 120.
The urban road vehicle monitoring system realizes file transmission based on an FTP (File Transfer protocol) protocol, wherein the FTP is a standard protocol for file transmission on the network based on a TCP/IP protocol, and works on the seventh layer of an OSI (open system interconnection) model and the third layer of the TCP model. The FTP protocol includes two components, one being an FTP server and the other being an FTP client. Wherein the FTP server is used for storing files, and the user can use the FTP client to access resources located on the FTP server through the FTP protocol. FTP allows users to communicate with remote hosts in a network in a file-operated manner and is robust and reliable. Based on the characteristic, by building the FTP service in the urban road vehicle monitoring system, the FTP client uploads the vehicle monitoring picture captured by the camera from the vehicle buckle to the FTP server through the FTP protocol.
In the embodiment of the application, the FTP server 110 is mainly used for acquiring a first connection request of the FTP client when the FTP client uploads the vehicle monitoring picture; establishing connection with the FTP client according to the first connection request; acquiring the vehicle monitoring picture uploaded by a user from the FTP client, and writing the vehicle monitoring picture into a local disk; determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture; sending a second connection request to the message server to establish a connection with the message server; if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture; if the connection establishment with the message server fails, circularly sending the second connection request; and if the cycle times reach a preset threshold value, the message entity is persisted in a local disk.
In this embodiment, the FTP client 100 may be a camera, and the FTP server 110 and the message server 120 may be independent servers respectively, or may also be a server network or a server cluster composed of servers, for example, the FTP server 110 described in this embodiment includes, but is not limited to, a computer, a network host, a single network server, multiple network server sets, or a cloud server composed of multiple servers. Among them, the cloud server is constituted by a large number of computers or web servers based on cloud computing (CloudComputing). In the embodiment of the present application, the control server and the User terminal may implement communication through any communication manner, including but not limited to mobile communication based on the third generation Partnership Project (3 GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or computer network communication based on the TCP/IP Protocol Suite (TCP/IP), User Datagram Protocol (UDP), and the like.
Those skilled in the art will understand that the application environment shown in fig. 1 is only one application scenario of the present invention, and does not constitute a limitation on the application scenario of the present invention, and that other application environments may further include more or less FTP clients 100 than those shown in fig. 1, or a server network connection relationship, for example, only 1 FTP client 100 and 1 FTP server 110 are shown in fig. 1, and it can be understood that the urban road vehicle monitoring system may further include one or more other FTP clients 100 network-connected to the FTP server 110, and is not limited herein in particular.
It should be noted that the scene schematic diagram of the urban road vehicle monitoring system shown in fig. 1 is only an example, and the urban road vehicle monitoring system and the scene described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation on the technical solution provided in the embodiment of the present application.
First, an embodiment of the present application provides a file transfer method, which is mainly applied to an FTP server, where the FTP server is located in an urban road vehicle monitoring system, the urban road vehicle monitoring system further includes an FTP client for uploading a vehicle monitoring picture captured by a camera from a vehicle gate and a message server for receiving the vehicle monitoring picture, and the method includes: when a user uploads the vehicle monitoring picture through the FTP client, a first connection request of the FTP client is obtained; establishing connection with the FTP client according to the first connection request; acquiring the vehicle monitoring picture uploaded by a user from the FTP client, and writing the vehicle monitoring picture into a local disk; determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture; sending a second connection request to the message server to establish a connection with the message server; if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture; if the connection establishment with the message server fails, circularly sending the second connection request; and if the cycle times reach a preset threshold value, the message entity is persisted in a local disk.
Fig. 2 is a flowchart of an embodiment of a file transfer method according to an embodiment of the present application. The transmission method provided by the embodiment of the application is applied to an FTP server, the FTP server is located in a city road vehicle monitoring system, the city road vehicle monitoring system further comprises an FTP client for uploading vehicle monitoring pictures snapped by a camera from a vehicle gate and a message server for receiving the vehicle monitoring pictures, referring to FIG. 2, the file transmission method comprises steps 210 to 280, and the detailed description is as follows:
210. and when the FTP client uploads the vehicle monitoring picture, acquiring a first connection request of the FTP client.
In some embodiments, the FTP client may be a camera network-connected to the FTP server, the vehicle monitoring picture is an image captured by the camera at the vehicle intersection and including vehicle information, the vehicle monitoring picture is acquired by the monitoring camera and then uploaded to the FTP server through the FTP client, at this time, the FTP client may send a first connection request to the FTP server to request the FTP client to establish a connection with the FTP server, and the FTP server may establish a connection with the FTP client based on a TCP protocol after acquiring the first connection request of the FTP client.
Of course, the FTP client may also be a mobile phone, a tablet, etc., and is not limited herein.
In some embodiments, before obtaining the first connection request of the FTP client, the method further includes: and blocking a monitoring port of the FTP server.
Because the FTP server needs to continuously provide the service of reading data from the monitoring port, when the FTP client does not send the first connection request, the main thread blocking program blocks the monitoring port of the FTP server, and the service of reading data from the monitoring port is prevented from exiting. When the FTP client sends the first connection request, the main thread blocks the program to exit, and does not block the monitoring port of the FTP server any more.
220. And establishing connection with the FTP client according to the first connection request.
In some embodiments, after receiving a first connection request sent by the FTP client, the FTP client sends a response request to the FPT client, so that the FTP client and the FTP server establish a connection based on a three-way handshake mechanism of a TCP protocol.
230. And obtaining the vehicle monitoring picture from the FTP client, and writing the vehicle monitoring picture into a local disk.
In some embodiments, after the FTP client establishes connection with the FTP server, the FTP client uploads the vehicle monitoring pictures, the FTP server obtains the vehicle monitoring pictures uploaded by the FTP client and writes the vehicle monitoring pictures into the local disk, and after the FTP server successfully writes the vehicle monitoring pictures into the local disk, a success response message is sent to the FTP client.
240. And determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture.
In some embodiments, the message entity may include information of FTPCOMMAND, FILENAME, FILETYPE, FILESIZE, FILEPATH, FTPURL, HTTP url, etc., where FTPCOMMAND represents an FTP protocol command currently executed by the FTP server, FILENAME represents a file name of the vehicle monitoring picture, FILESIZE represents a file size of the vehicle monitoring picture, FILETYPE represents a file type of the vehicle monitoring picture, FILEPATH represents a file storage path of the vehicle monitoring picture, FTPURL represents an FTP access path of the vehicle monitoring picture, HTTP url represents an HTTP access path of the vehicle monitoring picture, etc. The specific definition of the message entity is shown in the following table:
serial number Name (R) Length of Means of
1 FTPCOMMAND 255 Recording currently executed ftp protocol commands
2 FILENAME 1024 Filename
3 FILETYPE 255 File type, i.e. suffix name
4 FILESIZE 255 File size, unit: byte
5 FILEPATH 4096 File storage path
6 FTPURL 4096 FTP access path for files
7 HTTPURL 4096 HTTP access path for files
The FTP protocol command currently executed by the FTP server comprises a command for uploading a vehicle monitoring picture, and a command for renaming, modifying, deleting and the like the vehicle monitoring picture in the FTP server.
In addition, the vehicle monitoring picture can be named according to the information of the vehicle in the vehicle monitoring picture. The file name of the vehicle monitoring picture may include the device number of the camera, and the license plate number, the license plate color, the driving speed, the driving state, and the passing time of the vehicle in the vehicle monitoring picture. Therefore, the relevant information of the vehicle in the vehicle monitoring picture can be known through the file name of the vehicle monitoring picture.
The file name of the vehicle monitoring picture can be in the form of 'equipment number of a camera-license plate number-license plate color-driving speed-driving state-driving time · jpg' specifically, for example: the device number of the camera is 420110901299898910, the license plate number of the vehicle in the vehicle monitoring picture is jaw a12345, the license plate color is 2 (different numbers represent different colors), the driving speed is 53 (km/h), the driving state is 000000 (different numbers represent different driving states), and the passing time is 20200101115900 (11: 59: 0 sec. 1/11/2020), so that the file name of the vehicle monitoring picture is "420110901299898910-jaw a12345-2-53-000000-20200101000000. jpg".
250. And sending a second connection request to the message server to establish connection with the message server.
In some embodiments, after the FTP server sends the second connection request to the message server, if the message server receives the second connection request, a response request is returned, and if the FTP server receives the response request, the FTP server and the message server are successfully connected; and the FTP server does not receive the response request, or the FTP receives an error response request, and the connection between the FTP server and the message server fails.
The second connection request sent by the FTP server to the message server may be after the first connection request of the FTP client is obtained, or the first connection request and the second connection request are performed simultaneously, which is not limited herein.
260. And if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the message notification of uploading the vehicle monitoring picture.
In some embodiments, after the connection between the FTP server and the message server is successfully established, the message entity in the FTP server is sent to a message queue preset in the message server, so that the FTP client uploads the message notification of the vehicle monitoring picture, the message server can obtain the message of the vehicle monitoring picture in the FTP server in real time through the message entity without scanning the FTP server in real time, and when a large number of vehicle monitoring pictures are uploaded to the FTP server at the FTP client, the resource consumption of the urban road vehicle monitoring system can be reduced, and the working efficiency of the urban road vehicle monitoring system is greatly improved.
Moreover, message entities transmitted and stored between the FTP server and the message server are text data, so that the occupied memory and disk space are small, and great influence on network transmission and server storage cannot be caused.
In some embodiments, if the connection with the message server is successfully established, the sending the message entity to a message queue preset in the message server to implement uploading of the message notification of the vehicle monitoring picture includes:
1) and acquiring the value of the global connection state identifier IsConnected of the FTP server.
In some embodiments, the FTP server is provided with a global connection status flag IsConnected, which is used to determine whether the network connection between the FTP server and the message server is successfully established, and when the value of the function includes true and false, where true indicates that the network connection is successfully established and false indicates that the network connection is failed to be established.
2) And judging whether the connection with the message server is successfully established or not according to the IsConnected value.
In some embodiments, when the value of the obtained global connection state identifier IsConnected of the FTP server is true, it is determined that the connection between the FTP server and the message server is successful; and when the value of the obtained global connection state identifier IsConnected of the FTP server is false, judging that the connection between the FTP server and the message server fails.
3) And if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to upload the message notice of the vehicle monitoring picture.
In some embodiments, after the FTP server and the message server are successfully connected, the message entity of the vehicle monitoring picture in the FTP server is sent to a preset message queue in the message server, so that the message server can obtain the message of the vehicle monitoring picture in the FTP server according to the message entity without scanning the FTP server in real time, and when a large number of vehicle monitoring pictures are uploaded to the FTP server at the FTP client, the resource consumption of the urban road vehicle monitoring system can be reduced, and the working efficiency of the urban road vehicle monitoring system is greatly improved.
270. And if the connection establishment with the message server fails, circularly sending the second connection request.
In some embodiments, when the obtained value of the global connection status identifier IsConnected of the FTP server is false, it is determined that the FTP server fails to establish a connection with the message server. At this point, the FTP server may cycle through multiple times sending a second connection request to the messaging server to continue attempting to establish a connection.
In some embodiments, said cyclically transmitting said second connection request comprises: the second connection request is sent cyclically at increasing time intervals.
In some embodiments, by sending the second connection requests cyclically at increasing time intervals, that is, the time interval between two times of sending the second connection requests gradually increases, it is possible to avoid that network links are interrupted for a long time, or that, in the case that the message server is down for a long time, the FTP server sends too many second connection requests, which results in waste of network resources.
The time interval of the cyclic sending of the second connection request may be increased in an equal difference manner, may also be increased in an equal proportion manner, or may also be different in duration of the time interval of the second connection request. The time interval is specifically, for example: the time interval of the second connection request may be 1s, 2s, 4s, 8s, etc. in sequence, or the time interval of the second connection request may be 1min, 3min, 5min, 7min, etc., which is not limited herein.
280. And if the cycle times reach a preset threshold value, the message entity is persisted in a local disk.
In some embodiments, after the number of times that the FTP server sends the second connection request in a loop reaches the preset threshold, it indicates that the network link is interrupted for a long time, or the message server goes down for a long time, at this time, the message entity is persisted in the local disk of the FTP server, so as to ensure that the data of the vehicle monitoring picture in the FTP server is not lost under the condition that the message server is unavailable. The preset threshold may be set 3 times, 5 times, 10 times, and the like, and may be set according to an actual scene, which is not limited specifically.
And after the message entity is durably stored in the local disk and is marked as 'to be retransmitted' and the connection between the FTP server and the message server is reestablished, the FTP server retransmits the 'to be retransmitted' message entity to the message server.
And after the number of times that the FTP server sends the second connection request to the message server reaches a preset threshold value, the FTP server still continues to send the second connection request to the message server until the FTP server and the message server are successfully connected, and the global connection state identifier Isconnected of the FTP server is modified to be true.
According to the file transmission method provided by the embodiment of the application, when the connection with the message server fails, the second connection request is sent to the message server in a circulating mode, the message entity is persisted in the local disk when the circulating times reach the preset threshold value, and the message entity data of the vehicle monitoring picture in the FTP server is guaranteed not to be lost under the condition that the message server is unavailable, so that the message entity is retransmitted after the connection with the message server is successful in the later period, the phenomenon that the transmission of the vehicle monitoring picture is unstable due to network faults is avoided, and the reliability of the transmission of the message entity in the urban road vehicle monitoring system is improved.
In addition, the mode of circularly sending the second connection request to the message server has no invasion to the original vehicle monitoring picture transmission flow in the FTP server, and the reliability of the original vehicle monitoring picture transmission service of the FTP server can be maintained to the maximum extent.
In some embodiments, the process of obtaining the vehicle monitoring picture from the FTP client and writing the vehicle monitoring picture in a local disk may specifically include the following steps:
1) and acquiring a type command and a mode command sent by the FTP client, wherein the type command is used for indicating the setting of the file transmission type of the FTP server, and the mode command is used for indicating the setting of the file transmission mode of the FTP server.
Wherein the type command is used to specify the data type of the vehicle monitoring picture to be transmitted, including both ASCII and BINARY. The mode command is used for specifying a transmission mode of the vehicle monitoring picture to be transmitted, and comprises S, B and C modes, wherein S represents a stream, B represents a block, and C represents compression. The FTP client firstly sends a type command and a mode command to the FTP server to determine the data type and the transmission mode of the vehicle monitoring pictures to be transmitted between uploading of the vehicle monitoring pictures.
2) And setting the file transmission type and the file transmission mode of the FTP server according to the type command and the mode command.
In some embodiments, after the FTP client sends the type command and the mode command to the FTP server, the FTP server sets the transmission type of the vehicle monitoring picture according to the type command and the mode command, so that the transmission type and the transmission mode of the vehicle monitoring picture sent by the FTP client are the same as those of the vehicle monitoring picture received by the FTP server.
In some embodiments, after the file transfer type and the file transfer mode of the FTP server are set according to the type command and the mode command, a response message is also sent to the FTP client.
3) And acquiring a pasv command sent by the FTP client, wherein the pasv command is used for indicating that the access mode of the FTP server is set to be a passive mode.
In some embodiments, the FTP client sends a pasv command to the FTP server to tell the FTP server to allow the FTP server to monitor at the designated data port, so that the FTP server enters a state of passively receiving the request, and the access mode of the FTP server is a passive mode.
4) And updating the access mode of the FTP server according to the pasv command.
In some embodiments, by default, the FTP protocol uses two of the TCP ports, 20 and 21, with 20 ports for transmitting data and 21 ports for transmitting control information. By updating the access mode of the FTP server to the passive mode, the FTP server and the FTP client can negotiate to decide which port to use for transmission.
5) And acquiring a stor command which is sent by the FTP client and used for reminding the FTP server of receiving the vehicle monitoring picture.
In some embodiments, the function of the stor command is to upload a specified file and store it in a specified location. The FTP client can remind the FTP server to receive the corresponding vehicle monitoring picture by sending a stor command to the FTP server, and store the vehicle monitoring picture at a position corresponding to the local disk.
6) And determining the storage position of the vehicle monitoring picture in the local disk according to the stor command.
In some embodiments, after receiving the stor command sent by the FTP client, the FTP server can determine the storage address of the vehicle monitoring picture in the local disk according to the stor command.
7) And reading the file stream of the vehicle monitoring picture uploaded by the FTP client.
In some embodiments, the FTP client establishes a network connection with the FTP server through the data port, writes a file stream of the vehicle monitoring picture into the network connection, and the FTP server reads the file stream of the vehicle monitoring picture transmitted by the FTP client to obtain a corresponding vehicle monitoring picture.
8) And obtaining the vehicle monitoring picture from the file stream, and writing the vehicle monitoring picture into a local disk.
In some embodiments, the FTP client reads the data stream from the file stream and writes the data stream to a corresponding location in the local disk for storage, so as to store the vehicle monitoring picture in the local disk.
In some embodiments, the process of determining, according to the vehicle monitoring picture, a message entity for identifying the vehicle monitoring picture information may specifically include the following steps:
1) and acquiring the currently executed FTP protocol command.
In some embodiments, after the vehicle monitoring picture is stored in the local disk of the FTP server, the FTP server obtains the FTP protocol command currently being executed.
2) And acquiring the attributes of the vehicle monitoring picture, wherein the attributes of the vehicle monitoring picture comprise the file name, the file size, the file type and the file storage path of the vehicle monitoring picture.
3) And acquiring an FTP access path of the vehicle monitoring picture.
In some embodiments, the access to the vehicle monitoring picture in the FTP server is facilitated by obtaining an FTP access path of the vehicle monitoring picture.
In some embodiments, the process of obtaining the FTP access path of the vehicle monitoring picture may specifically include the following steps:
a. and acquiring the IP address and the port of the FTP server.
b. And splicing to generate an FTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture and the IP address and port of the FTP server.
In some embodiments, the master directory in the storage path of the vehicle monitoring picture can be replaced by the IP address and the port of the FTP server, so that the FTP access path of the vehicle monitoring picture is generated by splicing.
Specific examples thereof include:
the name of the vehicle monitoring picture is '20200301123023123', the type (or format) is 'jpg', the storage path is 'D: \ DataFile \2020\20200301123023123. jpg', the IP address of the FTP server is '192.168.0.10', the port is '21', when the FTP server generates the FTP access path by splicing, 'D: \ DataFile' is replaced by the value 'FTP:// 192.168.0.10: 21' of the ftpdic, the intermediate path 'FTP:// 192.168.0.10:21\2020\ 20201123023123. jpg' is obtained, and then all the 'pg' in the intermediate path is replaced by 'v', so that the complete FTP access path 'FTP:// 192.168.0.10: 21/2020/20200301123023. 23123. jpg' can be obtained.
4) And acquiring an HTTP access path of the vehicle monitoring picture.
In some embodiments, by obtaining the FTTP access path of the vehicle monitoring picture, the need for online browsing and processing of the vehicle monitoring picture in the FTP server can be met. Among them, the HTTP protocol (hypertext transfer protocol) is a transfer protocol for transferring a hypertext from a WWW server to a local browser. Hypertext information is stored in Web servers on the Internet, and clients need to transmit the hypertext information to be accessed through an HTTP protocol. The HTTP contains commands and transmission information, and can be used for Web access and communication among other Internet/intranet application systems, so that the integration of various application resource hypermedia access is realized.
In some embodiments, an HTTP service module is built in the FTP server, and the process of obtaining the HTTP access path of the vehicle monitoring picture may specifically include the following steps:
a. and acquiring the IP address of the FTP server.
b. And acquiring a service port of the HTTP service module.
c. And splicing to generate an HTTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture, the IP address and the service port.
In some embodiments, the FTP server is built-in with an HTTP service module which is a lightweight HTTP service module. The main directory in the storage path of the vehicle monitoring picture can be replaced by the IP address of the FTP server and the service port of the HTTP service module, so that the HTTP access path of the vehicle monitoring picture is generated by splicing.
Specific examples thereof include:
the name of the vehicle monitoring picture is '20200301123023123', the type (or format) is 'jpg', the storage path is 'D: \ DataFile \2020\20200301123023123. jpg', the IP address of the FTP server is '192.168.0.10', the service port of the HTTP service module is '8990', and when the FTP server generates the HTTP access path by splicing, firstly replacing 'D: \ DataFile' in the storage path with the value 'HTTP:// 192.168.0.10: 8990' of httpdic, obtaining the intermediate path 'HTTP:// 192.168.0.10:8990\ 2302020, 20200301123123. jpg', and then replacing all 'in the intermediate path with' \\\\\\\\ \ Tp '/', so that the complete FTaccess path 'httph// 192.168.0.10: 8990/2020/00301123123. jpg' can be obtained.
5) And generating the message entity according to the FTP protocol command, the attribute of the vehicle monitoring picture, the FTP access path and the HTTP access path.
In some embodiments, the attributes of the vehicle monitoring picture include a file name, a file size, a file type, a file storage path, and the like of the vehicle monitoring picture. The FTP protocol command currently executed by the FTP server, the FTP access path and the HTTP access path generated by splicing the FTP server, the file name, the file size, the file type, the file storage path and the like of the vehicle monitoring picture in the FTP server can be directly used as message entities.
Fig. 3 is a schematic structural diagram of an embodiment of a file transfer device according to an embodiment of the present application. As shown in fig. 3, in order to better implement the file transmission method in the embodiment of the present application, on the basis of the file transmission method, in the embodiment of the present application, a file transmission device 300 is further provided, which is used for an FTP server, where the FTP server is located in an urban road vehicle monitoring system, the urban road vehicle monitoring system further includes an FTP client for uploading a vehicle monitoring picture captured by a camera from a vehicle gate, and a message server for receiving the vehicle monitoring picture, where the file transmission device 300 includes:
a first obtaining module 310, configured to obtain a first connection request of the FTP client when the FTP client uploads the vehicle monitoring picture;
a first connection module 320, configured to establish a connection with the FTP client according to the first connection request;
the file acquisition module 330 is configured to acquire the vehicle monitoring picture from the FTP client, and write the vehicle monitoring picture into a local disk;
a determining module 340, configured to determine, according to the vehicle monitoring picture, a message entity that identifies the vehicle monitoring picture information;
a second connection module 350, configured to send a second connection request to the message server to establish a connection with the message server;
the notification module 360 is configured to send the message entity to a message queue preset in the message server if the connection with the message server is successfully established, so as to implement message notification for uploading the vehicle monitoring picture;
a loop connection module 370, configured to send the second connection request in a loop if the connection with the message server fails to be established;
the storage module 380 is configured to persist the message entity in the local disk if the cycle number reaches a preset threshold.
The file transmission device 300 provided by the embodiment of the application acquires a first connection request of an FTP client, establishes connection with the FTP client according to the first connection request, acquires a vehicle monitoring picture from the FTP client, writes the vehicle monitoring picture into a local disk, and determines a message entity for identifying information of the vehicle monitoring picture according to the vehicle monitoring picture; and then, sending a second connection request to the message server, if the connection with the message server is successful, sending a message entity to a message queue preset in the message server so as to realize the message notification of uploading the vehicle monitoring pictures by the FTP client, wherein the message server can acquire the change condition of the file state in the FTP server in real time through the message entity without scanning the FTP server in real time, and when a large number of vehicle monitoring pictures are uploaded to the FTP server by the FTP client, the resource consumption of the urban road vehicle monitoring system can be reduced, and the working efficiency of the urban road vehicle monitoring system is greatly improved.
And when the connection between the FTP server and the message server fails, the second connection request is sent to the message server in a circulating mode, and when the circulating times reach a preset threshold value, the message entity is persisted in a local disk, so that the message entity data of the vehicle monitoring picture in the FTP server can not be lost under the condition that the message server is unavailable, the message entity can be conveniently retransmitted after the connection with the message server is successful in the later period, the phenomenon that the transmission of the vehicle monitoring picture is unstable due to network faults is avoided, and the reliability of the transmission of the message entity in the urban road vehicle monitoring system is improved.
In some embodiments, the loop connection module 370 is configured to send the second connection request in a loop at increasing time intervals if the connection with the message server fails.
In some embodiments, the notification module 360 includes:
a second obtaining module, configured to obtain a value of a global connection status identifier IsConnected of the FTP server;
the judging module is used for judging whether the connection with the message server is successfully established according to the IsConnected value;
and the sub-notification module is used for sending the message entity to a preset message queue in the message server if the connection with the message server is successfully established so as to realize the message notification of uploading the vehicle monitoring picture.
In some embodiments, the determining module 340 comprises:
the first command acquisition module is used for acquiring the currently executed FTP protocol command;
the third acquisition module is used for acquiring the attributes of the vehicle monitoring picture, wherein the attributes of the vehicle monitoring picture comprise the file name, the file size, the file type and the file storage path of the vehicle monitoring picture;
the fourth acquisition module is used for acquiring an FTP access path of the vehicle monitoring picture;
the fifth acquisition module is used for acquiring an HTTP access path of the vehicle monitoring picture;
and the generating module is used for generating the message entity according to the FTP protocol command, the attribute of the vehicle monitoring picture, the FTP access path and the HTTP access path.
In some embodiments, the fourth obtaining module comprises:
the first sub-acquisition module is used for acquiring the IP address and the port of the FTP server;
and the first splicing module is used for splicing and generating an FTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture and the IP address and port of the FTP server.
In some embodiments, the fifth obtaining module comprises:
the second sub-acquisition module is used for acquiring the IP address of the FTP server;
the third sub-acquisition module is used for acquiring a service port of the HTTP service module;
and the second splicing module is used for splicing and generating the HTTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture, the IP address and the service port.
In some embodiments, the message entity includes an FTP protocol command currently executed by the FTP server, a file name of the vehicle monitoring picture, a file size of the vehicle monitoring picture, a file type of the vehicle monitoring picture, a file storage path of the vehicle monitoring picture, an FTP access path of the vehicle monitoring picture, and an HTTP access path of the vehicle monitoring picture.
The vehicle monitoring picture can be named according to the information of the vehicle in the vehicle monitoring picture. The file name of the vehicle monitoring picture may include the device number of the camera, and the license plate number, the license plate color, the driving speed, the driving state, and the passing time of the vehicle in the vehicle monitoring picture. Therefore, the relevant information of the vehicle in the vehicle monitoring picture can be known through the file name of the vehicle monitoring picture.
In some embodiments, the storage module 380 includes:
a second command acquisition module, configured to acquire a type command and a mode command sent by the FTP client, where the type command is used to instruct setting of a file transfer type of the FTP server, and the mode command is used to instruct setting of a file transfer mode of the FTP server;
the first setting module is used for setting the file transmission type and the file transmission mode of the FTP server according to the type command and the mode command;
a third command acquisition module, configured to acquire a pasv command sent by the FTP client, where the pasv command is used to indicate that an access mode of the FTP server is set as a passive mode;
the updating module is used for updating the access mode of the FTP server according to the pasv command;
the fourth command acquisition module is used for acquiring a stor command which is sent by the FTP client and used for reminding the FTP server of receiving the vehicle monitoring pictures;
the position determining module is used for determining the storage position of the vehicle monitoring picture in the local disk according to the stor command;
the reading module is used for reading the file stream of the vehicle monitoring picture uploaded by the FTP client;
and the writing module is used for obtaining the vehicle monitoring picture from the file stream and writing the vehicle monitoring picture into a local disk.
An embodiment of the present application further provides a server, which integrates any one of the file transmission devices provided in the embodiment of the present application, where the server includes:
one or more processors;
a memory; and
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor for performing the steps of the file transfer method described in any of the above embodiments of the file transfer method.
The embodiment of the application also provides a server, which integrates any one of the file transmission devices provided by the embodiment of the application. As shown in fig. 4, it shows a schematic structural diagram of a server according to an embodiment of the present application, specifically:
the server may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the server architecture shown in FIG. 4 is not meant to be limiting, and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is a control center of the server, connects various parts of the entire server using various interfaces and lines, and performs various functions of the server and processes data by running or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402, thereby performing overall monitoring of the server. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to the use of the server, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The server further includes a power supply 403 for supplying power to each component, and preferably, the power supply 403 may be logically connected to the processor 401 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The server may also include an input unit 404, the input unit 404 being operable to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the server may further include a display unit and the like, which will not be described in detail herein. Specifically, in this embodiment, the processor 401 in the server loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application program stored in the memory 402, thereby implementing various functions as follows:
when the FTP client uploads the vehicle monitoring picture, a first connection request of the FTP client is obtained;
establishing connection with the FTP client according to the first connection request;
the vehicle monitoring picture is obtained from the FTP client side and written into a local disk;
determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
sending a second connection request to the message server to establish a connection with the message server;
if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture;
if the connection establishment with the message server fails, circularly sending the second connection request;
and if the cycle times reach a preset threshold value, the message entity is persisted in a local disk.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, an embodiment of the present application provides a storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like. The storage medium stores a plurality of instructions, and the instructions can be loaded by the processor to execute the steps of any file transmission method provided by the embodiments of the present application. For example, the instructions may perform the steps of:
when the FTP client uploads the vehicle monitoring picture, a first connection request of the FTP client is obtained;
establishing connection with the FTP client according to the first connection request;
the vehicle monitoring picture is obtained from the FTP client side and written into a local disk;
determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
sending a second connection request to the message server to establish a connection with the message server;
if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture;
if the connection establishment with the message server fails, circularly sending the second connection request;
and if the cycle times reach a preset threshold value, the message entity is persisted in a local disk.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The foregoing describes in detail a file transmission, a device and a storage medium provided in an embodiment of the present application, and a specific example is applied in the present application to explain the principle and the implementation of the present application, and the description of the foregoing embodiment is only used to help understand the technical solution and the core idea of the present application; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (9)

1. A file transmission method is applied to an FTP server, the FTP server is located in an urban road vehicle monitoring system, the urban road vehicle monitoring system further comprises an FTP client used for uploading vehicle monitoring pictures captured by a camera from a vehicle gate, and a message server used for receiving the vehicle monitoring pictures, and the method comprises the following steps:
when the FTP client uploads the vehicle monitoring picture, a first connection request of the FTP client is obtained;
establishing connection with the FTP client according to the first connection request;
the vehicle monitoring picture is obtained from the FTP client side and written into a local disk;
determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
sending a second connection request to the message server to establish a connection with the message server;
if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the uploading of the message notice of the vehicle monitoring picture;
if the connection establishment with the message server fails, circularly sending the second connection request;
if the cycle times reach a preset threshold value, the message entity is persisted in a local disk;
the message entity comprises an FTP protocol command currently executed by the FTP server, a file name of the vehicle monitoring picture, a file size of the vehicle monitoring picture, a file type of the vehicle monitoring picture, a file storage path of the vehicle monitoring picture, an FTP access path of the vehicle monitoring picture and an HTTP access path of the vehicle monitoring picture;
the file name of the vehicle monitoring picture comprises the equipment number of the camera, and the license plate number, the license plate color, the driving speed, the driving state and the passing time of the vehicle in the vehicle monitoring picture.
2. The file transfer method according to claim 1, wherein said cyclically sending the second connection request comprises:
the second connection request is sent cyclically at increasing time intervals.
3. The file transmission method according to claim 1, wherein if the connection with the message server is successfully established, the message entity is sent to a message queue preset in the message server to realize the message notification of uploading the vehicle monitoring picture, and the method includes:
acquiring a value of a global connection state identifier IsConnected of the FTP server;
judging whether the connection with the message server is successfully established or not according to the IsConnected value;
and if the connection with the message server is successfully established, the message entity is sent to a preset message queue in the message server so as to realize the message notification of uploading the vehicle monitoring picture.
4. The file transfer method according to claim 1, wherein said determining a message entity identifying the vehicle monitoring picture information from the vehicle monitoring picture comprises:
acquiring a currently executed FTP protocol command;
acquiring attributes of the vehicle monitoring picture, wherein the attributes of the vehicle monitoring picture comprise a file name, a file size, a file type and a file storage path of the vehicle monitoring picture;
acquiring an FTP access path of the vehicle monitoring picture;
acquiring an HTTP access path of the vehicle monitoring picture;
and generating the message entity according to the FTP protocol command, the attribute of the vehicle monitoring picture, the FTP access path and the HTTP access path.
5. The file transfer method according to claim 4, wherein the obtaining of the FTP access path of the vehicle monitoring picture comprises:
acquiring an IP address and a port of the FTP server;
and splicing to generate an FTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture and the IP address and port of the FTP server.
6. The file transmission method according to claim 1, wherein an HTTP service module is built in the FTP server, and the obtaining of the HTTP access path of the vehicle monitoring picture includes:
acquiring an IP address of the FTP server;
acquiring a service port of the HTTP service module;
and splicing to generate an HTTP access path of the vehicle monitoring picture according to the storage path of the vehicle monitoring picture, the IP address and the service port.
7. The file transfer method according to claim 1, wherein the obtaining the vehicle monitoring picture from the FTP client and writing the vehicle monitoring picture to a local disk comprises:
acquiring a type command and a mode command sent by the FTP client, wherein the type command is used for indicating the setting of the file transmission type of the FTP server, and the mode command is used for indicating the setting of the file transmission mode of the FTP server;
setting a file transmission type and a file transmission mode of the FTP server according to the type command and the mode command;
acquiring a pasv command sent by the FTP client, wherein the pasv command is used for indicating that the access mode of the FTP server is set to be a passive mode;
updating the access mode of the FTP server according to the pasv command;
acquiring a stor command which is sent by the FTP client and used for reminding the FTP server of receiving a vehicle monitoring picture;
determining the storage position of the vehicle monitoring picture in the local disk according to the stor command;
reading a file stream of the vehicle monitoring picture uploaded by the FTP client;
and obtaining the vehicle monitoring picture from the file stream, and writing the vehicle monitoring picture into a local disk.
8. The utility model provides a file transfer device, its characterized in that is applied to the FTP server, the FTP server is located urban road vehicle monitored control system, urban road vehicle monitored control system still includes the FTP client that is used for uploading the vehicle control picture that the camera was taken a candid photograph from the vehicle bayonet socket, and is used for receiving the message server of vehicle control picture, file transfer device includes:
the first acquisition module is used for acquiring a first connection request of the FTP client when the FTP client uploads the vehicle monitoring picture;
the first connection module is used for establishing connection with the FTP client according to the first connection request;
the file acquisition module is used for acquiring the vehicle monitoring picture from the FTP client and writing the vehicle monitoring picture into a local disk;
the determining module is used for determining a message entity for identifying the vehicle monitoring picture information according to the vehicle monitoring picture;
the second connection module is used for sending a second connection request to the message server so as to establish connection with the message server;
the notification module is used for sending the message entity to a preset message queue in the message server if the connection with the message server is successfully established so as to realize the message notification of uploading the vehicle monitoring picture;
the circulating connection module is used for circularly sending the second connection request if the connection establishment with the message server fails;
the storage module is used for persisting the message entity in a local disk if the cycle number reaches a preset threshold value;
the message entity comprises an FTP protocol command currently executed by the FTP server, a file name of the vehicle monitoring picture, a file size of the vehicle monitoring picture, a file type of the vehicle monitoring picture, a file storage path of the vehicle monitoring picture, an FTP access path of the vehicle monitoring picture and an HTTP access path of the vehicle monitoring picture;
the file name of the vehicle monitoring picture comprises the equipment number of the camera, and the license plate number, the license plate color, the driving speed, the driving state and the passing time of the vehicle in the vehicle monitoring picture.
9. A computer-readable storage medium, having stored thereon a computer program which is loaded by a processor to perform the steps of the file transfer method of any one of claims 1 to 7.
CN202010321336.3A 2020-04-22 2020-04-22 File transmission method, device and storage medium Active CN111212151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010321336.3A CN111212151B (en) 2020-04-22 2020-04-22 File transmission method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010321336.3A CN111212151B (en) 2020-04-22 2020-04-22 File transmission method, device and storage medium

Publications (2)

Publication Number Publication Date
CN111212151A true CN111212151A (en) 2020-05-29
CN111212151B CN111212151B (en) 2020-07-07

Family

ID=70789976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010321336.3A Active CN111212151B (en) 2020-04-22 2020-04-22 File transmission method, device and storage medium

Country Status (1)

Country Link
CN (1) CN111212151B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452486A (en) * 2021-08-31 2021-09-28 腾讯科技(深圳)有限公司 Vehicle information uploading method, device, equipment and storage medium
CN114038229A (en) * 2021-10-21 2022-02-11 青岛海信网络科技股份有限公司 Roadside parking processing method and equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477620A (en) * 2008-12-31 2009-07-08 清华大学 Two-stage image abnormal movement detection method used for automobile anti-theft
US7778438B2 (en) * 2002-09-30 2010-08-17 Myport Technologies, Inc. Method for multi-media recognition, data conversion, creation of metatags, storage and search retrieval
CN105279197A (en) * 2014-07-24 2016-01-27 中国银联股份有限公司 Method and apparatus for establishing connection between JavaEE application server and database
CN106648444A (en) * 2015-10-30 2017-05-10 大唐移动通信设备有限公司 Message processing method and device
CN107329858A (en) * 2017-07-10 2017-11-07 上海哎媲媲网络技术有限公司 A kind of Quick fault-tolerance processing method of data write-in Redis failures
CN107959825A (en) * 2017-11-14 2018-04-24 浙江浙大中控信息技术有限公司 Police vehicle-mounted videograph evidence-obtaining system and monitoring method
CN109522391A (en) * 2018-11-27 2019-03-26 兰州智华辰宇交通科技有限公司 The vehicle-mounted log analysis of subway O&M and method for early warning
CN110458000A (en) * 2019-06-28 2019-11-15 安徽四创电子股份有限公司 A kind of video frequency vehicle recognition methods based on docker
CN110740293A (en) * 2019-09-06 2020-01-31 武汉烽火众智数字技术有限责任公司 data transmission method, system, device and computer storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7778438B2 (en) * 2002-09-30 2010-08-17 Myport Technologies, Inc. Method for multi-media recognition, data conversion, creation of metatags, storage and search retrieval
CN101477620A (en) * 2008-12-31 2009-07-08 清华大学 Two-stage image abnormal movement detection method used for automobile anti-theft
CN105279197A (en) * 2014-07-24 2016-01-27 中国银联股份有限公司 Method and apparatus for establishing connection between JavaEE application server and database
CN106648444A (en) * 2015-10-30 2017-05-10 大唐移动通信设备有限公司 Message processing method and device
CN107329858A (en) * 2017-07-10 2017-11-07 上海哎媲媲网络技术有限公司 A kind of Quick fault-tolerance processing method of data write-in Redis failures
CN107959825A (en) * 2017-11-14 2018-04-24 浙江浙大中控信息技术有限公司 Police vehicle-mounted videograph evidence-obtaining system and monitoring method
CN109522391A (en) * 2018-11-27 2019-03-26 兰州智华辰宇交通科技有限公司 The vehicle-mounted log analysis of subway O&M and method for early warning
CN110458000A (en) * 2019-06-28 2019-11-15 安徽四创电子股份有限公司 A kind of video frequency vehicle recognition methods based on docker
CN110740293A (en) * 2019-09-06 2020-01-31 武汉烽火众智数字技术有限责任公司 data transmission method, system, device and computer storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452486A (en) * 2021-08-31 2021-09-28 腾讯科技(深圳)有限公司 Vehicle information uploading method, device, equipment and storage medium
CN113452486B (en) * 2021-08-31 2021-11-23 腾讯科技(深圳)有限公司 Vehicle information uploading method, device, equipment and storage medium
CN114038229A (en) * 2021-10-21 2022-02-11 青岛海信网络科技股份有限公司 Roadside parking processing method and equipment

Also Published As

Publication number Publication date
CN111212151B (en) 2020-07-07

Similar Documents

Publication Publication Date Title
US20190332522A1 (en) Microservice platform with messaging system
JP3470955B2 (en) Method and apparatus for transferring data
US20230247388A1 (en) Communication system, method and device for miniature intelligent sensor
CN107820043B (en) Control method, device and system of video monitoring system
KR102114767B1 (en) Vehicle-based communication methods, systems and devices
CN111212151B (en) File transmission method, device and storage medium
CN111813570A (en) Event-driven message interaction method for power Internet of things
CN108632305B (en) Cloud storage system, media data storage method and system
US20170048590A1 (en) Method, device, and system for switching at a mobile terminal of a smart television and acquiring information at a television terminal
US20190288969A1 (en) Providing video to subscribers of a messaging system
US9215292B2 (en) Information processing apparatus, data distribution system, method of controlling information processing apparatus, and storage medium
CN113031874B (en) Cache processing method, device, equipment and storage medium based on Kubernetes cluster
CN111651418B (en) Document content downloading method and device, computer equipment and storage medium
WO2023217187A1 (en) Service response method and apparatus, device, and storage medium
CN111935497B (en) Video stream management method and data server for traffic police system
WO2023202295A1 (en) Memory management and control method and apparatus, storage medium and electronic device
CN109981778B (en) Method, device, equipment and storage medium for realizing service of content distribution network
CN115811538A (en) Method, apparatus, system and medium for requesting and processing digital key service
CN114785695A (en) High-performance network communication library realized based on zeroC ICE
CN104516883A (en) Webpage sharing method, device and system
CN110392017B (en) Method and related device for processing RPC message
US9106608B2 (en) Communication device, communication method, and non-transitory computer-readable recording medium
CN113568687A (en) Method for displaying Web page, related equipment and computer readable storage medium
CN110457392B (en) Copy reading and writing method and device
JP7189104B2 (en) Information processing system and control method for information processing system

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
GR01 Patent grant
GR01 Patent grant