Image processing system, relay server, and program for relaying communications

An image processing system includes: an application server located in the Internet; an image processing apparatus located in a local network connected to the Internet via a firewall; a relay server configured to relay communication between the image processing apparatus and the application server, the relay server being located in the local network; and a connection mediation server configured to transmit, to the relay server, a request for a connection to the application server, the connection mediation server being located in the Internet, wherein the connection mediation server includes a connection request transmitting unit so as to have communication established between the image processing apparatus and the application server, the relay server includes: a communication establishing unit; a job transferring unit; a job identifying unit; and a communication terminating unit, and after the communication terminating unit terminates the communication, the communication establishing unit reestablishes the communication.

The entire disclosure of Japanese Patent Application No. 2014-135569 filed on Jul. 1, 2014 including description, claims, drawings, and abstract are incorporated herein by reference in its entirety.

BACKGROUND OF THE INVENTION

Field of the Invention

One or more embodiments of the invention relate to an image processing system, a relay server, and a program, and more particularly, to a technology for relaying communication between a server located in the Internet and an image processing apparatus.

Description of the Related Art

Various application servers for SaaS (Software as a Service) applications and the like are located in a cloud in the Internet, and cloud services are provided by the application servers via the Internet these days. A cloud service offers high convenience, as it can be used at anytime from anywhere as long as Internet access is available. In an example of use of a cloud service, the data of documents or the like is stored in an application server, and the data is transferred from the application server to an image processing apparatus located in an intra-company local network, and is printed out.

However, there is a firewall existing between a local network and the Internet. Therefore, when a user issues a job execution instruction to an application server, data is not transferred from the application server in the Internet to an image processing apparatus or the like located in a local network. In view of this, an image processing system shown inFIG. 11has been suggested so as to realize such data transfer, for example.

The conventional image processing system shown inFIG. 11includes an application server110in the Internet100, and a connection mediation server111cooperating with the application server110. Meanwhile, in a local network101such as an intra-company LAN (Local Area Network), a relay server120and image processing apparatuses130and131are located, for example. There may be only a single image processing apparatus in the local network101. The relay server120is a server that relays communication between the image processing apparatuses130and131and the application server110. When activated by a power supply, this relay server120establishes a connection140to the connection mediation server111located in the Internet100. With this, the connection mediation server111becomes able to constantly communicate with the relay server120located in the local network101over a firewall.

In this image processing system, when the application server110transmits a job to the image processing apparatus130located in the local network101, for example, the application server110first transmits a communication start request D101designating the image processing apparatus130to the connection mediation server111. Receiving the communication start request D101, the connection mediation server111identifies the relay server120that manages the image processing apparatus130based on information registered in advance, and transmits a connection request D102to the relay server120. This connection request D102contains address information for connecting to the application server110, and the like. Receiving the connection request D102from the connection mediation server111, the relay server120transmits a connection start request D103to the application server110based on the address information and the like contained in the connection request D102. With this, the relay server120and the application server110are connected, and the application server110becomes able to start job transmission to the relay server120located in the local network101. When the job transmission from the application server110is completed, the relay server120transfers the job received from the application server110to the image processing apparatus130. In this manner, the image processing apparatus130becomes able to receive a job transmitted from the application server110via the relay server120, and perform image processing based on the job.

In the above described image processing system, however, all the jobs that are transmitted from a server or the like outside the local network101to an image processing apparatus or the like in the local network101are relayed by the relay server120. So as to cause the relay server120to achieve a certain processing capacity, there is an upper limit on the number of connections the relay server120can establish with a server or the like outside the local network101, such as the application server110. If the number of connections between the relay server120and the application server110is the upper limit, a new connection for transmitting a job cannot be established between the application server110and the relay server120even when a user issues a job transmission instruction designating the image processing apparatus130to the application server110. In that case, the user has to wait until the relay server120becomes able to establish a new connection as the currently-executed job is completed, for example. Therefore, a long period of time might be required for executing a new job. Furthermore, during the period between transmission of a job to the image processing apparatus130and completion of execution of the job in the image processing apparatus130, maintaining a connection between the application server110and the relay server120even when there is no transmission/reception of data or the like between the two servers is inappropriate in terms of effective use of communication.

In view of this, JP 2009-296473A discloses an image forming apparatus that has a server cooperation function to transmit data to a server and cause the server to process the data. In this image forming apparatus, the connection to the server is temporarily terminated after data is transmitted to the server. When the processing by the server is completed, the server transmits a connection request to the image forming apparatus, so that data can be transmitted from the server to the image forming apparatus. In the above described image processing system, however, there is a firewall existing between a local network and the Internet as described above. Therefore, a connection request cannot be transmitted from the server to the image forming apparatus of JP 2009-296473 A, and the technology disclosed in JP 2009-296473 A cannot be applied to the above described image processing system.

SUMMARY OF THE INVENTION

One or more embodiments of the invention may provide an image processing system that can efficiently transmit a job or the like from an application server and effectively use communication, a relay server, and a program.

In accordance with one or more embodiments of the invention, an image processing system comprises: an application server located in the Internet; an image processing apparatus located in a local network connected to the Internet via a firewall; a relay server configured to relay communication between the image processing apparatus and the application server, the relay server being located in the local network; and a connection mediation server configured to transmit, to the relay server, a request for a connection to the application server, the connection mediation server being located in the Internet, wherein the connection mediation server includes a connection request transmitting unit configured to transmit a connection request to the relay server when receiving a communication start request designating the image processing apparatus from the application server, so as to have communication established between the image processing apparatus and the application server, the relay server includes: a communication establishing unit configured to establish the communication by connecting to the application server in accordance with the connection request from the connection mediation server; a job transferring unit configured to transfer a job received from the application server to the image processing apparatus; a job identifying unit configured to identify a type of the job; and a communication terminating unit configured to terminate the communication when there is no transmission/reception being performed between the application server and the relay server in accordance with the job type identified by the job identifying unit, and after the communication terminating unit terminates the communication, the communication establishing unit reestablishes the communication by connecting to the application server after receiving data to be transmitted to the application server from the image processing apparatus, and transfers the data.

According to an invention of Item.2, in the image processing system of Item.1, the communication terminating unit terminates the communication when determining that a predetermined time or longer is required between the transfer of the job to the image processing apparatus and the reception of the data.

According to an invention of Item.3, in the image processing system of Item.1or2, the communication terminating unit terminates the communication, without notifying the application server.

According to an invention of Item.4, in the image processing system of Item.3, the communication establishing unit generates a socket for connecting to the application server based on reception of the connection request from the connection mediation server and establishes the communication, and the communication terminating unit terminates the communication by discarding the socket.

According to an invention of Item.5, in the image processing system of Item.3or4, the communication establishing unit reestablishes the communication, without notifying the application server.

According to an invention of Item.6, in the image processing system of any one of Items.1to5, the relay server further includes a storage unit that stores server connection information identifying the application server to be connected to in accordance with the connection request, and device connection information identifying the image processing apparatus to be connected to for transferring the job received from the application server, the server connection information and the device connection information being associated with each other. When receiving a notification of completion of the job from the image processing apparatus identified by the device connection information, the communication establishing unit reestablishes the communication by connecting to the application server based on the server connection information stored and associated with the device connection information in the storage unit.

In accordance with one or more embodiments of the invention, a relay server that is located in a local network connected to the Internet via a firewall, connects to a connection mediation server located in the Internet, connects to an application server located in the Internet based on a connection request received from the connection mediation server, and relays communication between an image processing apparatus located in the local network and the application server, the relay server reflecting one aspect of the present invention comprises: a communication establishing unit configured to establish communication between the image processing apparatus and the application server by connecting to the application server in accordance with the connection request from the connection mediation server; a job transferring unit configured to transfer a job received from the application server to the image processing apparatus; a job identifying unit configured to identify a type of the job; and a communication terminating unit configured to terminate the communication when there is no transmission/reception being performed between the application server and the relay server in accordance with the job type identified by the job identifying unit, wherein, after the communication terminating unit terminates the communication, the communication establishing unit reestablishes the communication by connecting to the application server after receiving data to be transmitted to the application server from the image processing apparatus, and transfers the data.

According to an invention of Item.8, in the relay server of Item.7, the communication terminating unit terminates the communication when determining that a predetermined time or longer is required between the transfer of the job to the image processing apparatus and the reception of the data.

According to an invention of Item.9, in the relay server of Item.7or8, the communication terminating unit terminates the communication, without notifying the application server.

According to an invention of Item.10, in the relay server of Item.9, the communication establishing unit generates a socket for connecting to the application server based on reception of the connection request from the connection mediation server and establishes the communication, and the communication terminating unit terminates the communication by discarding the socket.

According to an invention of Item.11, in the relay server of any one of Items.7to10, the communication establishing unit reestablishes the communication, without notifying the application server.

According to an invention of Item.12, in the relay server of any one of Items.7to11, the relay server further includes a storage unit that stores server connection information identifying the application server to be connected to in accordance with the connection request, and device connection information identifying the image processing apparatus to be connected to for transferring the job received from the application server, the server connection information and the device connection information being associated with each other. When receiving a notification of completion of the job from the image processing apparatus identified by the device connection information, the communication establishing unit reestablishes the communication by connecting to the application server based on the server connection information stored and associated with the device connection information in the storage unit.

In accordance with one or more embodiments of the invention, a non-transitory recording medium storing a computer readable program that is a program to be executed by a computer functioning as a relay server that is located in a local network connected to the Internet via a firewall, connects to a connection mediation server located in the Internet, connects to an application server located in the Internet based on a connection request received from the connection mediation server, and relays communication between an image processing apparatus located in the local network and the application server, the program reflecting one aspect of the present invention causes the computer to carry out: (a) the step of establishing communication between the image processing apparatus and the application server by connecting to the application server in accordance with the connection request from the connection mediation server; (b) the step of transferring a job received from the application server to the image processing apparatus; (c) the step of identifying a type of the job; (d) the step of terminating the communication when there is no transmission/reception being performed between the application server and the relay server in accordance with the job type identified in the step (c); and (e) the step of reestablishing the communication to transfer data to the application server by connecting to the application server after terminating the communication in the step (d) and receiving the data from the image processing apparatus.

According to an invention of Item.14, in the non-transitory recording medium storing a computer readable program of Item.13, when determining that a predetermined time or longer is required between transfer of the job to the image processing apparatus and reception of the data in the step (d), the computer terminates the communication.

According to an invention of Item.15, in the non-transitory recording medium storing a computer readable program of Item.13, in the step (d), the computer terminates the communication, without notifying the application server.

According to an invention of Item.16, in the non-transitory recording medium storing a computer readable program of Item.15, in the step (a), the computer generates a socket for connecting to the application server based on reception of the connection request from the connection mediation server, and establishes the communication, and, in the step (d), the computer terminates the communication by discarding the socket.

According to an invention of Item.17, in the non-transitory recording medium storing a computer readable program of Item.15, in the step (e), the computer reestablishes the communication, without notifying the application server.

According to an invention of Item.18, in the non-transitory recording medium storing a computer readable program of Item.13, the program further causes the computer to carry out (f) the step of storing server connection information identifying the application server to be connected to in accordance with the connection request, and device connection information identifying the image processing apparatus to be connected to for transferring the job received from the application server, the server connection information and the device connection information being associated with each other, and, in the step (e), when receiving a notification of completion of the job from the image processing apparatus identified by the device connection information, the computer reestablishes the communication by connecting to the application server based on the server connection information stored and associated with the device connection information in the storage unit.

DETAILED DESCRIPTION OF EMBODIMENTS

Hereinafter, embodiments of the invention will be described in detail with reference to the drawings. However, the scope of the invention is not limited to the illustrated examples. Throughout the examples described below, like components are denoted by like reference numerals, and explanation of overlapping features among those components will not be made more than once.

FIG. 1is a diagram showing an example configuration of an image processing system1in accordance with one or more embodiments of the invention. In a network environment where the Internet2and a local network3are connected via a firewall4, this image processing system1has a configuration in which an application server5and a connection mediation server6are set in the Internet2, and the firewall4, a relay server7, and image processing apparatuses8aand8bare set in the local network3. Although more than one image processing apparatus is shown in the drawing, there may be only a single image processing apparatus.

The application server5is a server that provides various kinds of application services (cloud services) through SaaS (Software as a Service) applications, for example. Specifically, the application server5provides a storage service via the Internet2, for example, and can store various kinds of data such as documents. An information processing terminal10can be connected to the application server5via the local network3or a different network from the local network3, such as a public telephone network. The information processing terminal10can store data into the application server5, and transmit jobs to the image processing apparatuses8aand8bin the local network3via the application server5.

The connection mediation server6is a server that transmits, to the relay server7, a request for a connection to the application server5. Receiving a communication start request designating the image processing apparatus8aor8bfrom the application server5, the connection mediation server6transmits a connection request to the relay server7, to establish communication between the relay server7and the application server5.

The firewall4is an interface that connects to the local network3such as a LAN to the Internet2. When a device that is set in the local network3is connected to a server that is set in the Internet2, the firewall4allows intercommunication between the device and the server. When the device in the local network3is not connected to the server in the Internet2, the firewall4blocks access of the server to the local network3.

The relay server7is a gateway server that is set in the local network3and relays communication between the image processing apparatus8aor Bb and the application server5. The image processing apparatuses8aand8bare formed with multifunction machines or printers, for example, and can perform image processing based on data that is input via the local network3.

In the image processing system1, when activated with power supply, the relay server7establishes a constant connection to the connection mediation server6in the Internet2via the firewall4. Accordingly, receiving a communication start request from the application server5, the connection mediation server6can transmit a connection request to the relay server7in the local network3over the firewall4.

For example, a user connects to the application server5with the information processing terminal10such as a smartphone, a tablet terminal, or a personal computer, and issues a job execution instruction specifying scanning of a document or the like in the image processing apparatus8a. In turn, the application server5transmits, to the connection mediation server6, a communication start request designating the image processing apparatus8a. Receiving the communication start request from the application server5, the connection mediation server6transmits a connection request to the relay server7. This connection request contains address information for connecting to the application server5, and the like. For example, receiving the connection request from the connection mediation server6, the relay server7generates a socket for connecting to the application server5, and transmits an HTTP (Hypertext Transfer Protocol) request to the application server5via the socket. Receiving the HTTP request transmitted from the relay server7, the application server5generates a socket for communicating with the relay server7, and returns an HTTP response via the socket. With this, the relay server7and the application server5establish an HTTP session over the firewall4. Such an HTTP session is generated for each job, for example. As the HTTP session is established, the relay server7and the application server5are connected to each other, establishing intercommunication. As a result, the application server5becomes able to transmit a job such as a scan job to the relay server7, using the HTTP session established with the relay server7as the tunnel. Although an HTTP session is established between the relay server7and the application server5in this example, it may not be through an HTTP session that communication is established between the relay server7and the application server5.

After establishing the communication with the application server5, the relay server7receives a job from the application server5, transfers the job to the image processing apparatus8a, and relays communication between the application server5and the image processing apparatus8a. Receiving the job transferred from the relay server7, the image processing apparatus8aexecutes the job, and performs scanning. There is a predetermined upper limit set on the number of connections the relay server7can simultaneously establish with the application server5in the Internet2. Therefore, if the number of current connections to the application server5in the Internet2has not reached the upper limit when the relay server7receives a connection request from the connection mediation server6, the relay server7connects to the application server5. If the number of current connections has already reached the upper limit, on the other hand, the relay server7does not connect to the application server5even when receiving a connection request from the connection mediation server6.

The relay server7also has a function to identify the type of a job received from the application server5. Various types of jobs are transmitted from the application server5to the image processing apparatus8a, and the frequency of data communication between the image processing apparatus8aand the application server5through the above described HTTP session serving as a tunnel varies depending on the types of jobs. Therefore, if the relay server7identifies the type of a job as one involving a period during which no data communication is conducted between the application server5and the image processing apparatus8a, the relay server7terminates the communication between the application server5and the image processing apparatus8a. For example, in a case where a scan job received from the application server5is a job involving an OCR (Optical Character Recognition) process, the image processing apparatus8arequires a predetermined time or longer before the end of execution of the job, performing the OCR process to recognize each one of the characters contained in the image data read through scanning. If a predetermined time or longer is required to execute a job as in this case, the relay server7temporarily terminates the connection to the application server5. However, even if a job is identified as one that requires a predetermined time or longer before the end of execution thereof, termination of the connection in the middle of data transmission/reception between the application server5and the relay server7causes an error, as data cannot be appropriately transmitted/received. Therefore, when sensing that there is no data transmission/reception being performed with the application server5, the relay server7terminates the connection. However, this termination of connection is not to appropriately terminate the above described HTTP session with both the relay server7and the application server5. That is, the relay server7terminates the connection to the application server5by one-sidedly discarding the socket forming the HTTP session with application server5, without notifying the application server5of the termination of the HTTP session.

If the relay server7temporarily terminates the connection to the application server5, the relay server7maintains the connection-terminated state before receiving data to be transmitted to the application server5from the image processing apparatus8a. After receiving data to be transmitted to the application server5from the image processing apparatus8a, the relay server7reconnects to the application server5, to reestablish the communication between the application server5and the image processing apparatus8a, and transfer the data to the application server5. In doing so, the relay server7again generates a socket for connecting to the application server5, and incorporates the socket into an already-established HTTP session, to restore the connection to the application server5, which has been temporarily terminated. As described above, when reestablishing connection, the relay server7does not establish a new HTTP session through the same procedures as those carried out when receiving a connection request from the connection mediation server6, but reestablishes the same communication as before by restoring the HTTP session that has been temporarily discarded in a one-sided manner.

For example, in a case where scanning is performed in the image processing apparatus8a, scan data generated through the scanning is transmitted to the relay server7. Scan data may be collectively transmitted to the relay server7after all the pages to be scanned are read, or the scan data of one page may be transmitted to the relay server7every time one of the pages to be scanned is read. The relay server7may reconnect to the application server5and transfer the scan data of all the pages, after receiving the scan data of all the pages. Alternatively, the relay server7may reconnect to the application server5after receiving part of scan data (the scan data of the first page, for example), and transfer scan data to the application server5every time receiving scan data. Through such procedures, the relay server7can temporarily reduce the number of connections to the application server5by temporarily terminating the connection to the application server5between the time when receiving a job from the application server5and the time when receiving the data to be transmitted to the application server5from the image processing apparatus8a. Accordingly, the relay server7can establish new communication for receiving a new job from the application server5in the Internet2. Thus, communication efficiency can be improved while the number of connections to the application server5is kept within the upper limit.

Next, the respective functions of the connection mediation server6and the relay server7of the image processing system1are described. As shown inFIG. 2, the connection mediation server6includes a control unit14formed with a CPU and a memory, and a communication interface15for communicating with the application server5and the relay server7. As the CPU executes a predetermined program, the control unit14functions as a connection request transmitting unit16. The connection request transmitting unit16is a processing unit that transmits a connection request to the relay server7when the connection mediation server6receives a communication start request designating the image processing apparatus8aor8bfrom the application server5. The connection request transmitting unit16then causes the relay server7to connect to the application server5, to establish communication between the image processing apparatus8aor8band the application server5. This connection request contains the information about the image processing apparatus8aor8bdesignated as the output destination, and the address information for connecting to the application server5. In addition to the address information about the application server5, the connection request may contain the port number identifying the application that controls job-related communication. Since the connection mediation server6is constantly connected to the relay server7, the connection request transmitting unit16transmits the connection request to the relay server7, taking advantage of the constantly-connected state. Accordingly, the connection request is not blocked by the firewall4, but is appropriately received by the relay server7.

Next, the relay server7is described.FIG. 3is a block diagram showing an example hardware configuration and an example functional structure of the relay server7in accordance with one or more embodiments of the invention. The relay server7includes a control unit20formed with a CPU and a memory, a storage unit21formed with a hard disk drive (HDD) or the like, and a communication interface22for conducting communication in the local network3. As the CPU executes a predetermined program, the control unit20functions as a communication establishing unit25, a job transferring unit26, a job identifying unit27, and a communication terminating unit28.

The communication establishing unit25is a processing unit that connects to the application server5in accordance with a connection request received from the connection mediation server6, and, after connecting to the application server5, relays communication between the image processing apparatus8aor8band the application server5. Based on the address information about the application server5contained in the connection request, the communication establishing unit25transmits a connection start request such as an HTTP request to the application server5. In turn, the application server5returns an HTTP response in reply to the connection start request, so that the relay server7connects to the application server5. In a case where the connection request also contains a port number, the communication establishing unit25may transmit a connection start request, designating the application identified by the port number in the application server5. In this case, the connection start request can be transmitted to a destination that is the application for controlling job-related communication in the application server5. Accordingly, a connection can be accurately established. After the relay server7connects to the application server5, a job that designates the image processing apparatus8aor8bas the output destination is transmitted from the application server5to the relay server7. The job received from the application server5is then transferred from the job transferring unit26to the image processing apparatus8aor8bdesignated as the job output destination.

After the communication terminating unit28described later temporarily terminates the communication between the image processing apparatus8aor8band the application server5, the communication establishing unit25receives the data to be transmitted to the application server5from the image processing apparatus8aor8b, and then reconnects to the application server5, to reestablish the communication between the image processing apparatus8aor8band the application server5, and transfer the data received from the image processing apparatus8aor8bto the application server5. For example, receiving a notification of an end of print job execution from the image processing apparatus8aor8b, the communication establishing unit25reestablishes the connection to the application server5, and transfers the notification of an end of print job execution to the application server5. In a case where the job is a scan job, after receiving all or part of the scan data generated through the scan job from the image processing apparatus8aor8b, the relay server7reconnects to the application server5, to transfer the received scan data. The application server5then notifies the user of the normal end of the job, or the data is then stored into the application server5. The processing related to the job is thus completed.

The job identifying unit27is a processing unit that identifies the type of a job received from the application server5. In a case where a connection to the application server5is established by the communication establishing unit25, and a job that designates the image processing apparatus8ais received from the application server5, the job transferring unit26transfers the job to the image processing apparatus8a. At the same time, the job identifying unit27performs a process of identifying the type of the job. The job identifying unit27identifies the type of the job such as a scan job or a print job by analyzing the setting information about the job, for example. In the case of a scan job, the job identifying unit27also determines whether the scan job is accompanied by a job that requires a certain processing time or longer for an OCR process or an image data compression process, for example. In the case of a print job, the job identifying unit27also identifies print settings, such as the number of pages, a paper size, a paper type, color or monochrome printing, and double-side printing.

In accordance with a job type identified by the job identifying unit27, the communication terminating unit28determines whether the job causes no data transmission/reception between the application server5and the relay server7for a predetermined time or longer. If the job causes no data transmission/reception between the application server5and the relay server7for a predetermined time or longer, the communication terminating unit28temporarily terminates the communication between the application server5and the image processing apparatus8aor8bwhen no data is being transmitted/received between the application server5and the relay server7. For example, in a case where the job type identified by the job identifying unit27is a scan job accompanied by a job that requires a certain processing time or longer for an OCR process or an image data compression process or the like, the communication terminating unit28terminates the connection to the application server5when no data is being transmitted/received between the application server5and the relay server7while such a scan job is being executed in the image processing apparatus8aor8b. In a case where the job type identified by the job identifying unit27is a print job, and the print settings include a certain setting, such as the number of pages being equal to or larger than a predetermined number, the paper size being equal to or larger than a predetermined size, the paper thickness being equal to or greater than a predetermined thickness, the print job being color printing or double-side printing, the communication terminating unit28terminates the connection to the application server5when no data is being transmitted/received between the application server5and the relay server7while such a print job is being executed in the image processing apparatus8aor8b. With this, between the start and the end of a job executed in the image processing apparatus8aor8b, the relay server7can establish a new connection to the application server5for a new job, so that the application server5outside the local network3can transmit a new job to the relay server7. Alternatively, in accordance with the job type identified by the job identifying unit27, the communication terminating unit28may estimate, through calculation, the time required between the start and the end of execution of the job, for example. If the estimated time is equal to or longer than a predetermined time, the communication terminating unit28may terminate the connection to the application server5.

The storage unit21stores a control table29that is generated and managed by the communication establishing unit25, and device information30related to the image processing apparatuses8aand8b. The control table29stores information in which a new connection (an HTTP session, for example) to the application server5established by the communication establishing unit25is recorded at the time of the establishment of the new connection, and the communication establishing unit25refers to the information when reconnecting to the application server5after the connection is terminated by the communication terminating unit28. In the table information recorded in this control table29, server connection information29aidentifying the application server5to be connected to in accordance with a connection request received from the connection mediation server6is associated, on a one-to-one basis, with device connection information29bidentifying the image processing apparatus8aor8bas the transfer destination of a job received from the application server5. In the device information30, the functions and the process capacities of the image processing apparatuses8aand8bas job transfer destinations are registered in advance.

FIG. 4is a table showing an example of the control table29in accordance with one or more embodiments of the invention. The communication establishing unit25acquires, from a connection request, the address information and the like for connecting to the application server5, and the address information and the like about the image processing apparatus8aor8bdesignated as the output destination. When establishing a new connection to the application server5based on the connection request, the communication establishing unit25registers the information for connecting to the application server5in the control table29. Also, receiving a job from the application server5after establishing the new connection to the application server5, the communication establishing unit25identifies the output destination of the job, and registers the information about the image processing apparatus as the output destination in the control table29. The server connection information29aidentifying the application server5to be connected to include a connection ID, the application address indicating the address of the application server5, and the application port number of the application that controls communication related to the job in the application server5, for example. A connection flag indicating the current status of the current connection is also included in some cases. When the connection flag is ON, the application server5and the relay server7are connected to each other. When the connection flag is OFF, the application server5and the relay server7are temporarily disconnected from each other.

The device connection information29bincludes the device address identifying the device of the image processing apparatus8aor8bdesignated as the output destination, and the port number (device port number) of the relay server7connected to the device. The server connection information29aand the device connection information29brelated to certain job transmission are associated with each other on a one-to-one basis, and are registered in the control table29. Receiving the data to be transmitted to the application server5from the image processing apparatus8aor8bidentified by the device connection information29b, the communication establishing unit25restores the connection to the application server5identified by the server connection information29abased on the server connection information29astored and associated with the device connection information29bin the control table29, and reestablishes the communication between the application server5and the image processing apparatus8aor8b. In a case where a notification of an end of print job execution is received from the image processing apparatus8a, or where all or part of the scan data in a scan job is received from the image processing apparatus8a, the communication establishing unit25refers to the control table29, and identifies the current device connection information29bbased on the device address of the image processing apparatus8aand the port number (device port number) of its own device that has received the notification of an end of job execution or the scan data. The communication establishing unit25then refers to the server connection information29aassociated with the current device connection information29b. Based on the server connection information29a, the communication establishing unit25restores the connection to the corresponding application server5to the same state as the state prior to the connection termination, and transfers the data received from the image processing apparatus8a. By referring to the control table29described above, the communication establishing unit25promptly identifies the temporarily-terminated connection (an HTTP session, for example) to the application server5, and restores the connection. In this manner, the communication establishing unit25can establish a reconnection to the application server5. The server connection information29afurther includes the application port number identifying the application that controls communication related to the current job in the application server5. Accordingly, even in a case where two or more jobs are transmitted from the same application server5to the relay server7, and the communication terminating unit28temporarily terminates one of the connections to the application server5established for the respective jobs by the communication establishing unit25, the application corresponding to the job can be identified, and a reconnection to the application server5can be established. Thus, a reconnection can be more efficiently realized.

Referring back toFIG. 3, the device information30is the information related to the image processing apparatuses8aand8bto be connected to the relay server7in the local network3. For example, the device information30is acquired in advance when the relay server7connects to the image processing apparatuses8aand8b, and is stored into the storage unit21. This device information30is referred to when the communication terminating unit28estimates the time required between the start and the end of job execution. For example, in the device information30, information such as the functions and the processing capacities of the respective image processing apparatuses8aand8bis registered in advance as described above. Accordingly, the communication terminating unit28can accurately calculate the time required between the start and the end of execution of a job in the image processing apparatus8aor8b, by referring to the device information30based on the type of the job identified by the job identifying unit27. If the calculated time is longer than a predetermined time, the communication terminating unit28determines to temporarily terminate the connection to the application server5. Accordingly, in a case where a job received from the application server5is a job that requires a long processing time, the connection between the application server5and the relay server7is temporarily terminated, so that the application server5outside the local network3can be reconnected to the relay server7and transmit a new job to the relay server7. However, in a case where a job type identified by the job identifying unit27is a predetermined type, the communication terminating unit28may determine whether to temporarily terminate the connection to the application server5, regardless of the processing time calculated based on the device information30.

FIG. 5is a diagram showing an outline of the flow of each process in a case where the relay server receives a scan job and transfers the scan job to an image processing apparatus, and the relay server also terminates a connection to an application server in accordance with one or more embodiments of the invention. First, when the relay server7is activated (process P1), the relay server7establishes a constant connection to the connection mediation server6(process P2). As a result, the connection mediation server6becomes able to transmit a connection request to the relay server7at any time. After that, when a scan job designating the image processing apparatus8aas the output destination is designated in the application server5(process P3), the application server5transmits a communication start request to the connection mediation server6(process P4). Receiving this communication start request, the connection mediation server6transmits a connection request to the relay server7(process P5). Receiving the connection request, the relay server7transmits a connection start request to the application server5based on the address of the application server5and the like contained in the connection request (process P6), and connects to the application server5as the application server5accepts the connection start request. Connecting to the application server5, the number of connections between the relay server7and the application server5outside the local network3becomes n (process P7). When the scan job is transmitted from the application server5to the relay server7(process P8), the relay server7transmits the scan job to the image processing apparatus8adesignated as the output destination (process P9). Receiving the scan job, the image processing apparatus8astarts scanning a document or the like.

As well as transmitting the scan job to the image processing apparatus8a(process P9described above), the relay server7identifies the type of the scan job (process P11). In accordance with the identified job type, the relay server7temporarily terminates the connection when there is no transmission/reception being performed with the application server5(process P12). As to whether to temporarily terminate the connection to the application server5, if the identified scan job is determined to be a job that involves a time-consuming process such as an OCR process or an image data compression process, the relay server7determines that no data transmission/reception will be performed between the application server5and the relay server7for a predetermined time or longer, and temporarily terminates the connection, while the scan job is being executed in the image processing apparatus8a. Before the scan data generated as a result of execution of the scan job by the image processing apparatus8ais received by the relay server7, there is no data transmission/reception between the relay server7and the application server5. Therefore, before the scan job is completed, by temporarily terminating the connection between the relay server7and the application server5, the relay server7can connect to a server or the like outside the local network3, so as to receive a new job from the server or the like. Thus, communication can be effectively used.

When temporarily terminating the connection to the application server5in process P12, the relay server7might do so by one-sidedly discarding the socket, without notifying the application server5of the termination of the HTTP session. If the application server5recognizes the termination of the HTTP session with the relay server7, the application server5performs error processing on the assumption that an error occurred before the end of the scan job, and notifies the user that an error has occurred before the end of the job. In a case where the connection is temporarily terminated though the relay server7has not notified the application server5that the HTTP session is to be terminated, the application server5does not perform any error processing, not realizing that the connection to the relay server7is temporarily terminated. Therefore, the application server5does not notify the user that an error has occurred.

Temporarily terminating the connection to the application server5(process P12described above), the relay server7subtracts one from the number of connections to the application server5(process P13). The connection flag in the corresponding server connection information29ain the control table29is set to OFF, so that the registration is updated. During the period (t1) between process P12and a reconnection to the application server5in process P16, which will be described later, the relay server7can establish a new connection to the application server5, so as to receive a new job. When the image processing apparatus8acompletes the scanning (process P14), the image processing apparatus8atransmits the generated scan data of all the pages to the relay server7. In addition to that, the image processing apparatus8amay also transmit a notification of an end of job execution (process P15). Receiving the scan data and the notification, the relay server7reconnects to the application server5, so as to transfer the scan data (process P16). At this point, the relay server7again generates a socket, and incorporates the socket into an established HTTP session, to restore the temporarily-terminated connection. By doing so, the relay server7can reconnect to the application server5, without causing the application server5to realize that the connection is temporarily terminated and a reconnection is then established. Thus, it is possible to prevent the application server5from performing error processing.

Reconnecting to the application server5, the relay server7returns the number of current connections to the application server5to n (process P17). The connection flag in the corresponding server connection information29ain the control table29is set to ON, so that the registration is updated. The scan data received from the image processing apparatus8ais then transferred to the application server5(process P18). Receiving the scan data, the application server5performs the process of terminating the connection to the relay server7as the scan job has been completed (process P19), and transmits a connection termination request to the relay server7(process P20). Receiving the connection termination request, the relay server7also performs the process of terminating the connection to the application server5(process P21).

FIG. 6is a diagram showing an outline of the flow of each process in a case where the relay server calculates a print processing time and maintains a connection to the application server5, when the relay server receives a print job and transfers the print job to the image processing apparatus8ain accordance with one or more embodiments of the invention. First, when the relay server7is activated (process P1), the relay server7establishes a constant connection to the connection mediation server6(process P2). After that, when the application server5designates a print job indicating the image processing apparatus8aas the output destination (process P3), the application server5transmits a communication start request to the connection mediation server6, designating the image processing apparatus8aas the output destination (process P4). Receiving the connection start request, the connection mediation server6transmits a connection request to the relay server7(process P5). Receiving the connection request, the relay server7transmits a connection start request to the application server5based on the address of the application server5and the like contained in the connection request (process P6), and connects to the application server5by establishing an HTTP session. As a result, the number of connections between the relay server7and a server or the like outside the local network3becomes n (process P7). When the print job is transmitted from the application server5to the relay server7(process P8), the relay server7transmits the print job to the image processing apparatus8a(process P9). Receiving the print job, the image processing apparatus8astarts printing (process P10). Meanwhile, the relay server7identifies the type of the print job (process P11). The relay server7analyzes the setting information about the print job, to determine the number of pages to be printed, the paper size, and existence/non-existence of color print setting. After determining the contents of the identified job, the relay server7refers to the device information30in the storage unit21, and calculates the time required for executing the print job (process P12). If the calculated time required for executing the job is equal to or longer than a predetermined time, the relay server7can temporarily terminate the connection to the application server5before the relay server7receives a notification of an end of job execution from the image processing apparatus8a. In the example shown inFIG. 6, however, the time required for executing the print job is equal to or shorter than the predetermined time, and therefore, the relay server7does not temporarily terminate the connection to the application server5. In a case where the time required for job execution is not equal to or longer than the predetermined time as in this case, soon after the connection to the application server5is temporarily terminated, a reconnection needs to be established, and communication is not effectively used. Therefore, the complicated process of establishing a reconnection immediately after the connection to the application server5is temporarily terminated is avoided, and the connection to the application server5can be maintained.

When the printing is completed in the image processing apparatus8a(process P13), the image processing apparatus8atransmits a print end notification to the relay server7(process P14), and the relay server7transfers the received print end notification to the application server5(process P15). With this, the application server5recognizes that the print job has been appropriately completed, and notifies the user to that effect. The application server5then performs the process of terminating the connection to the relay server7as the print job has been completed (process P16), and transmits a connection termination request to the relay server7(process P17). In reply to the connection termination request, the relay server7performs the process of terminating the connection to the application server5(process P18).

Referring now toFIG. 7, a specific example of processing procedures in the relay server7in accordance with one or more embodiments of the invention is described. The flowchart shown inFIG. 7is a flowchart showing an example of processes related to a job transmitted to the relay server7from a server or the like in the Internet, and an example case where a job is transmitted from the application server5to the relay server7is described below. When power is supplied, the relay server7establishes a connection to the connection mediation server6, and maintains the connection until the power supply is cut off (step S1). After establishing the connection to the connection mediation server6, the relay server7determines whether the relay server7has received a connection request for a connection to the application server5from the connection mediation server6(step S2). If the relay server7has not received a connection request (NO in step S2), the relay server7awaits reception of a connection request. If the relay server7determines that it has received a connection request (YES in step S2), the relay server7determines whether the current number (n) of connections to a server or the like outside the local network3is the upper limit (nmax) of the number of connections the relay server7can establish (step S3). The relay server7functions as a gateway that relays communication between a device such as the image processing apparatus8aor8bset in the local network3and a server or the like in the Internet. There is an upper limit on the number of connections to the application server5, as described above. If the relay server7determines that the current number (n) of connections is not the upper limit (nmax) (NO in step S3), the relay server7transmits a connection start request to the application server5(step S4), and confirms establishment of a connection to the application server5, receiving an HTTP response from the application server5(step S5). The relay server7then adds 1 to the current number (n) of connections to the application server5(step S6). The relay server7also updates the control table29by adding the information for connecting to the application server5to the server connection information29ain the control table29. If the relay server7determines that the current number (n) of connections is the upper limit (n=nmax) of the number of connections the relay server7can establish (YES in step S3), the relay server7does not transmit a connection start request to the application server5, but continues to await reception of a connection request.

When connecting to the application server5, the relay server7determines whether the relay server7has received a job from the application server5(step S7). If the relay server7determines that it has received a job (YES in step S7), the relay server7transfers the job to the image processing apparatus8adesignated as the output destination, for example (step S8). The relay server7also updates the control table29by adding the information about the image processing apparatus8aas the output destination of the job to the device connection information29bin the control table29. After transferring data to the image processing apparatus8a, the relay server7performs a server connection temporary termination process to temporarily terminate the connection to the application server5(step S10). The server connection temporary termination process will be described later in detail. The relay server7next determines whether the relay server7has received scan data generated through job execution and a notification of an end of job execution from the image processing apparatus8ato which the job has been transferred (step S11). If the relay server7determines that it has not received scan data generated through job execution and a notification of an end of job execution or the like from the image processing apparatus8a(NO in step S11), the relay server7awaits reception of scan data and a notification. If the relay server7determines that it has received scan data and a notification of an end of job execution or the like from the image processing apparatus8a(YES in step S1), on the other hand, the relay server7identifies the device connection information29bcorresponding to the job by referring to the control table29, and determines whether the connection flag is ON by referring to the server connection information29aregistered and associated with the corresponding device connection information29bon a one-to-one basis (step S12). If the relay server7determines that the connection flag is ON (YES in step S12), the connection between the application server5and the relay server7is maintained, and therefore, the relay server7transfers the scan data and the notification of an end of job execution received from the image processing apparatus8a, to the application server5(step S13). If the relay server7determines that the connection flag is OFF (NO in step S12), on the other hand, the connection between the application server5and the relay server7is temporarily terminated. Therefore, the relay server7performs a server reconnection process for reconnecting to the application server5(step S14). After reconnecting to the application server5, the relay server7transfers the data received from the image processing apparatus8a(step S13). The server reconnection process will be described later in detail.

After transferring the data and the notification of an end of job execution received from the image processing apparatus8ato the application server5in step S13, the relay server7performs a server connection normal termination process to terminate the connection to the application server5(step S15). The server connection normal termination process will be described later in detail. After performing the server connection normal termination process (step S15), the relay server7awaits reception of a new connection request from the connection mediation server6.

If the relay server7determines in step S7that it has not received a job from the application server5(NO in step S7), the relay server7determines whether a predetermined time has passed (step S9). If the relay server7determines that the predetermined time has not passed yet (NO in step S9), the relay server7returns to step S7, and determines whether it has received a job from the application server5. If the relay server7determines that the predetermined time has passed without reception of a job from the application server5(YES in step S9), the relay server7skips the processes in steps S8to S13, and performs the server connection normal termination process to terminate the connection to the application server5(step S15). If the relay server7does not receive a job from the application server5within the predetermined time, the relay server7terminates the connection, so that a connection can be established to allow the application server5to transmit a new job to the relay server7. Accordingly, effective use of communication is facilitated.

FIG. 8is a flowchart showing a specific example of the processing procedures in the server connection temporary termination process (step S10inFIG. 7) in accordance with one or more embodiments of the invention. The relay server7first analyzes the setting information about the job received from the application server5(step S21). Taking into account the results of the analysis of the job, the relay server7determines whether to temporarily terminate the connection to the application server5(step S22). As for the criteria in determining whether to terminate the connection, if the relay server7determines that a predetermined time or longer is required between the time when the relay server7transfers the job to the image processing apparatus8aand the time when the relay server7receives the data to be transmitted to the application server5as a result of the job executed by the image processing apparatus8, the relay server7may determine to temporarily terminate the connection to the application server5. It should be noted that the specific method of determining whether the predetermined time or longer is required to receive the data may differ among jobs. In the case of a print job, for example, a notification of an end of job execution is transmitted from the image processing apparatus8ato the relay server7after the end of the print job. By referring to the device information30related to the image processing apparatus8aas the output destination, the relay server7calculates the time required to execute the print job, and may determine whether the predetermined time or longer is required to receive the data, depending on whether the calculated job execution time is equal to or longer than a predetermined time. In an example case of a scan job, the relay server7may determine whether the predetermined time or longer is required to receive the data, depending on whether the scan job involves a time-consuming process such as an OCR process or an image data compression process.

If the relay server7determines not to temporarily terminate the connection to the application server5(NO in step S22), the relay server7ends the server connection temporary termination process. If the relay server7determines to temporarily terminate the connection to the application server5(YES in step S22), on the other hand, the relay server7one-sidedly discards the socket generated for establishing the HTTP session with the application server5(step S23). With this, the HTTP session with the application server5comes to an end. As the relay server7terminates the HTTP session by one-sidedly discarding the socket without notifying the application server5of the termination, the application server5does not recognize that the connection to the relay server7is temporarily terminated. Accordingly, the application server5can be prevented from performing error processing. After discarding the socket, the relay server7updates the server connection information29aby switching the connection flag from ON to OFF in the server connection information29ain the control table29(step S24). The relay server7then subtracts one from the current number (n) of connections between the relay server7and the application server5(step S25), and ends the server connection temporary termination process. Accordingly, while the connection between the relay server7and the application server5is temporarily terminated, a new connection can be established to allow the application server5to transmit a new job to the relay server7.

FIG. 9is a flowchart showing a specific example of the processing procedures in the server reconnection process (step S14inFIG. 7) in accordance with one or more embodiments of the invention. The relay server7first determines whether the current number (n) of connections between the relay server7and the application server5is the upper limit (nmax) of the number of connections the relay server7can establish (step S31). If the relay server7determines that the current number of connections is the upper limit (n=nmax) of the number of connections that can be established (YES in step S31), the relay server7is not able to establish a new connection to the application server5in the Internet, and therefore, awaits until the current number of connections becomes smaller than the upper limit of the number of connections that can be established. If the relay server7determines that the current number of connections is not the upper limit of the number of connections that can be established (NO in step S31), the relay server7generates a socket for connecting to the application server5based on the server connection information29aassociated on a one-to-one basis with the device connection information29bin the control table29related to the connection between the image processing apparatus8athat has received the job and the relay server7(step S32). The relay server7then restores the connection by incorporating the generated socket into an already-established HTTP session with the application server5(step S33), and adds one to the current number of connections between the relay server7and the application server5(step S34). In this manner, the relay server7can promptly identify a server or the like to be reconnected to, by referring to the device connection information29bin the control table29and the server connection information29aregistered and associated with the device connection information29b. Particularly, in a case where the server connection information29afurther includes the application port number identifying the application that controls communication related to the current job in the application server5, if the application server5and the relay server7are processing two or more jobs, and there are two or more connections existing between the two servers, the relay server7can identify the application that controls communication related to the current job, and accurately reconnect to the application server5.

FIG. 10is a flowchart showing a specific example of the processing procedures in the server connection normal termination process (step S15inFIG. 7) in accordance with one or more embodiments of the invention. The relay server7first determines whether the relay server7has received a connection termination request from the application server5(step S41). When the data received by the relay server7from the image processing apparatus8aand a notification of an end of job execution are transferred to the application server5(equivalent to step S13inFIG. 7), the application server5determines that the job has been appropriately completed, and performs the process of terminating the connection between the application server5and the relay server7. The application server5then transmits a connection termination request to the relay server7. Alternatively, if the application server5performs the termination process prior to job transmission to the relay server7(equivalent to YES in step S9inFIG. 7), the application server5transmits a connection termination request to the relay server7.

If the relay server7determines that it has not received a connection termination request from the application server5(NO in step S41), the relay server7awaits until reception of a connection termination request. If the relay server7determines that it has received a connection termination request (YES in step S41), on the other hand, the relay server7discards the socket generated for connecting to the application server5(step S42), and subtracts one from the current number (n) of connections between the relay server7and the application server5. The relay server7then ends the server connection normal termination process.

As described so far, in the image processing system1in accordance with one or more embodiments of the invention, the relay server7temporarily terminates a connection to the application server5in accordance with the type of a job received through the connection to the application server5. After receiving the data to be transmitted to the application server5from the image processing apparatus8a, the relay server7reconnects to the application server5. Accordingly, the number of connections the relay server7can establish with the application server5can be increased by one before the relay server7receives the data from the image processing apparatus8a. Thus, effective use of communication can be facilitated.

Although embodiments of the present invention have been described so far, the invention is not limited to the above described specific examples of the embodiments, and various modifications can be made to them.

For example, in the above described embodiments, the relay server7relays communication between an image processing apparatus or the like in the local network3and the application server5in the Internet. However, an image processing apparatus such as a multifunction printer may include the above described functions of the relay server7.

According to embodiments of the present invention, a relay server terminates a connection between an application server and the relay server in accordance with the type of a job received from the application server. After receiving the data to be transmitted to the application server from an image processing apparatus, the relay server reconnects to the application server, and transfers the data. In this structure, while the connection between the application server and the relay server is terminated, new communication for transmitting a new job can be established between a server or the like in the Internet and the relay server. Accordingly, jobs can be efficiently transmitted, and effective use of communication can be facilitated.