Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for discovering a network media server based on DHCP, which solve the problems that when a DLNA client discovers a DLNA server, a requirement for network devices through which the DLNA server passes downward is high, and when a plurality of DLNA servers exist on a network, the DLNA client discovers the plurality of DLNA servers, and load balancing cannot be performed.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in a first aspect, a DHCP-based method for discovering a network media server is provided, including:
the DHCP equipment determines a network media server communicating with the client according to the gateway position information acquired by the DHCP equipment and the network media server load information stored in the DHCP equipment;
and sending the determined address of the network media server to the gateway.
In a first possible implementation manner, the DHCP device is a DHCP relay device or a DHCP server, where the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server, where the port number communicates with the client.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, if the DHCP device is a DHCP relay device, before the DHCP device determines a network media server communicating with a client according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, the method further includes:
receiving an address allocation request sent by the gateway, wherein the address allocation request is a DHCP discovery message or a DHCP request message;
and determining the gateway position information according to the port number of the first port of the address allocation request received by the DHCP relay device, wherein the gateway position information includes the port number of the first port, or the gateway position information includes the port number of the first port and the board number of the board where the first port is located, or the gateway position information includes the port number of the first port, the board number of the board where the first port is located and the frame number of the frame where the board is located.
With reference to the first possible implementation manner of the first aspect, in a third possible implementation manner, if the DHCP device is a DHCP server, before the DHCP device determines, according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, a network media server that communicates with a client, the method further includes:
receiving a first address allocation request sent by a DHCP relay device, where the first address allocation request carries gateway location information of a gateway, where the gateway location information includes a port number of a first port of a second address allocation request sent by the gateway and received by the DHCP relay device, or the gateway location information includes a port number of a first port of a second address allocation request sent by the gateway and a board number of a board where the first port is located, received by the DHCP relay device, or the gateway location information includes a port number of a first port of a second address allocation request sent by the gateway, a board number of a board where the first port is located, and a frame number of a frame where the board is located, received by the DHCP relay device;
the second address allocation request is a DHCP discovery message sent by the gateway, and the first address allocation request is a DHCP discovery message which is obtained by the DHCP relay device after receiving the DHCP discovery message sent by the gateway and carries Option 82;
or,
the second address allocation request is a DHCP request message sent by the gateway, and the first address allocation request is a DHCP request message which is obtained by the DHCP relay device after receiving the DHCP request message sent by the gateway and carries Option 82.
With reference to the first aspect or any one of the first to third possible implementation manners of the first aspect, in a fourth possible implementation manner, the network media server is a Digital Living Network Alliance (DLNA) server or a server based on a hypertext transfer protocol (HTTP); the client is a DLNA client;
the method further comprises the following steps:
and the DHCP equipment sends the address of the gateway acquired based on DHCP to the gateway.
In a second aspect, another DHCP-based method for discovering a network media server is provided, including:
the gateway sends an address allocation request to the DHCP device;
receiving an address allocation response sent by the DHCP device, wherein the address allocation response comprises the address of the network media server determined by the DHCP device;
the method comprises the steps that a gateway sends an authentication request to a determined network media server under the condition that the gateway does not receive a request for triggering the gateway to authenticate sent by a Digital Living Network Alliance (DLNA) client;
after passing the authentication of the determined network media server, receiving the relevant information of the determined network media server sent by the determined network media server;
and sending the determined network media server related information to the DLNA client, wherein the determined network media server related information is used for responding to the registration request.
In a first possible implementation manner, the sending the determined network media server related information to the DLNA client includes:
multicasting and sending the determined network media server related information to the DLNA client; or,
and after receiving the request message, unicast-sending the determined related information of the network media server to the DLNA client side sending the request message.
With reference to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner, the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server, which is in communication with the client.
With reference to the second aspect or the first possible implementation manner or the second possible implementation manner of the second aspect, in a third possible implementation manner, the network media server related information includes: the determined services that the network media server can provide.
With reference to the second aspect or any one of the first to third possible implementation manners of the second aspect, in a fourth possible implementation manner, the address allocation response further includes: and the DHCP equipment acquires the address of the gateway based on DHCP.
In a third aspect, a DHCP apparatus is provided, including:
the processor is used for determining a network media server which communicates with the client according to the gateway position information acquired by the DHCP equipment and the network media server load information stored in the DHCP equipment;
and the transmitter is used for transmitting the determined address of the network media server to the gateway.
In a first possible implementation manner, the DHCP device is a DHCP relay device or a DHCP server, where the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server, where the port number communicates with the client.
With reference to the second aspect, in a second possible implementation manner, if the DHCP device is a DHCP relay device, the DHCP device further includes:
the client side comprises a receiver and a client side, wherein the receiver is used for receiving an address allocation request sent by a gateway before the DHCP equipment determines a network media server communicating with the client side according to gateway position information acquired by the DHCP equipment and network media server load information stored in the DHCP equipment, and the address allocation request is a DHCP discovery message or a DHCP request message;
the processor is further configured to determine the gateway location information according to the port number of the first port, which is on the DHCP relay device and receives the address allocation request, where the gateway location information includes the port number of the first port, or the gateway location information includes the port number of the first port and a board number of a board where the first port is located, or the gateway location information includes the port number of the first port, the board number of the board where the first port is located, and a frame number of a frame where the board is located.
With reference to the second aspect, in a third possible implementation manner, if the DHCP device is a DHCP server, the receiver is further configured to receive a first address allocation request sent by a DHCP relay device before the DHCP device determines a network media server for communicating with a client according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, where the first address allocation request carries gateway location information of the gateway, and the gateway location information includes a port number of a first port where the DHCP relay device receives a second address allocation request sent by the gateway, or the gateway location information includes a port number of a first port where the DHCP relay device receives the second address allocation request sent by the gateway and a board number of a board where the first port is located, or, the gateway location information includes a port number of a first port, a board number of a board where the first port is located, and a frame number of a frame where the board is located, where the DHCP relay device receives a second address assignment request sent by the gateway;
the second address allocation request is a DHCP discovery message sent by the gateway, and the first address allocation request is a DHCP discovery message which is obtained by the DHCP relay device after receiving the DHCP discovery message sent by the gateway and carries Option 82;
or,
the second address allocation request is a DHCP request message sent by the gateway, and the first address allocation request is a DHCP request message which is obtained by the DHCP relay device after receiving the DHCP request message sent by the gateway and carries Option 82.
With reference to the second aspect or any one of the first possible implementation manner to the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the network media server is a Digital Living Network Alliance (DLNA) server or a server based on a hypertext transfer protocol (HTTP); the client is a DLNA client;
the sender is further configured to send the address of the gateway obtained based on DHCP to the gateway.
In a fourth aspect, there is provided a gateway comprising:
a transmitter for transmitting an address assignment request to the DHCP device; under the condition that a request for triggering a gateway to authenticate sent by a Digital Living Network Alliance (DLNA) client is not received, sending an authentication request to a determined network media server; sending the determined network media server related information to the DLNA client, wherein the determined network media server related information is used for responding to the registration request;
the receiver is used for receiving an address allocation response sent by the DHCP device, wherein the address allocation response comprises the address of the network media server determined by the DHCP device; and after the authentication of the determined network media server is passed, receiving the relevant information of the determined network media server sent by the determined network media server.
In a first possible implementation manner, the transmitter is specifically configured to multicast and transmit the determined network media server-related information to the DLNA client; or after receiving the request message, unicast-sending the determined network media server related information to the DLNA client side sending the request message.
With reference to the fourth aspect or the first possible implementation manner of the fourth aspect, in a second possible implementation manner, the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server, which is in communication with the client.
With reference to the fourth aspect or the first possible implementation manner or the second possible implementation manner of the fourth aspect, in a third possible implementation manner, the network media server related information includes: the determined services that the network media server can provide.
With reference to the fourth aspect or any one of the first to third possible implementation manners of the fourth aspect, in a fourth possible implementation manner, the address allocation response further includes: and the DHCP equipment acquires the address of the gateway based on DHCP.
After the scheme is adopted, the DHCP device determines a network media server (i.e., a DLNA server) that provides services for a DLNA client and notifies the address and port information of the DLNA server to the gateway in a DHCP message, so that the gateway initiates an authentication process to the DLNA server when not receiving a request for triggering the gateway to perform authentication, which is sent by the DLNA client in the digital living network alliance, and the DLNA server returns specific relevant information (such as Location, USN, and the like) after the authentication is successful. Therefore, the gateway can inform the DLNA client of the related information of the network media server, so that the DLNA client can communicate with the network media server, and multicast message replication does not need to be supported by network equipment downwards from the DLNA server. Therefore, the embodiment can avoid or reduce the requirement for multicast message replication of network equipment downward from the DLNA server. In addition, optionally, the DHCP device determines a network media server communicating with the DLNA client according to the acquired location information and the stored network media server load information, and when a plurality of DLNA servers exist on the network, the DHCP device may determine, for the DLNA client, a DLNA server with a closer location and/or a smaller load, so as to perform load balancing on the DLNA servers.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, 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 invention.
The method for discovering a network media server based on DHCP provided by this embodiment may include, but is not limited to, the following entity apparatuses: DLNA servers, DHCP relay devices, DHCP servers, gateways, DLNA clients, etc.
In order to more clearly describe the embodiment, the above entities, and DLNA, DHCP, and the like are first briefly described.
One, DLNA
DLNA is a consortium of consumer electronics, mobile phone and computer vendors. The organization aims to establish a set of industry standards which can enable products of various manufacturers to be connected and adapted to each other, so that digital life is realized for consumers.
The main definitions of DLNA are several devices (i.e. a DLNA server may include but is not limited to):
a Digital Media Server (DMS) that provides a source for acquiring, recording, storing and originating Media;
a Digital Media Player (DMP), a device that can find and play or output any Media provided by the DMS;
a Digital Media Controller (DMC) used as a remote control device, which can search the multimedia file on the DMS, and designate the DMP that can play the Media file to play or control the device that uploads the multimedia file to or from the DMS;
the core protocol of DLNA is UPnP (The Universal Plug and Play, Universal Plug and Play) protocol.
Two, DHCP
In this embodiment, the IP address of the gateway for communication may be automatically obtained in a DHCP manner, and the specific steps may include:
1) DHCP Discovery (DISCOVER)
The gateway may apply for the last IP address it uses. The DHCP server may grant the application if this IP is still available in the network in which the gateway is located. Otherwise, it is necessary to see if the DHCP server is authorized or unauthorized. The authoritative DHCP server will reject the request so that the gateway immediately applies for a new IP. The unauthorized DHCP server simply ignores the request, resulting in a timeout of the gateway request, whereupon the gateway will abandon the request and request a new IP address.
2) DHCP provisioning (OFFER)
When the DHCP server receives an IP lease request from a gateway, it provides an IP lease to the gateway. The DHCP server reserves an IP address for the gateway and then sends a DHCP OFFER message to the client over the network. The DHCPOFFER message may include, but is not limited to: the MAC address of the DHCP server that sends the DHCP OFFER, the IP address provided by the server, the subnet mask, the lease, and the IP of the DHCP server that provides the IP, etc.
3) DHCP REQUEST (REQUEST)
When the gateway receives a DHCP OFFER message containing an IP lease it must tell all other DHCP servers that it has accepted a lease OFFER. Thus, the gateway will send a DHCP REQUEST message that may include, but is not limited to, the IP of the DHCP server that provided the lease. When the other DHCP servers receive the DHCP REQUEST message, they will reclaim all leases that may have been provided to the gateway. They then replace the IP address once reserved for the gateway back into an available address so that they can still assign this IP address to other computers. Any number of DHCP servers may respond to the same IP lease request, but each gateway can only accept one lease offer.
4) DHCP Acknowledgement (ACK)
When the DHCP server receives the DHCP REQUEST message from the gateway, it starts the final phase of the configuration process. This response phase includes sending a DHCP ACK message to the gateway. The DHCP ACK message may include, but is not limited to: lease and all other configuration information that the gateway may request.
Three, DHCP relay equipment (namely DHCP RELAY)
The early DHCP protocol is only suitable for the condition that the DLNA client and the DHCP server are positioned in the same subnet, and cannot work across network segments. DHCP RELAY relay service is carried out between DLNA client and DHCP server between different sub-networks, DHCP protocol message can be relayed to cross-network segment destination DHCP server or DLNA client.
As shown in fig. 1, the work flow of DHCP RELAY may include:
1) the gateway sends DHCP RELAY an address configuration request. If the subnet has the DHCP server, the DHCP address configuration can be directly carried out without DHCP RELAY; if no DHCP server exists in the subnet, the network device with DHCP RELAY function is sent to the network;
2) DHCP RELAY, after receiving the address configuration request of the gateway, adding an Option82 (a message name) to the address configuration request, and sending the address configuration request added with the Option82 to the DHCP server in a unicast mode;
3) after receiving the address configuration request added with the Option82, the DHCP server configures an IP address for the gateway and sends a DHCP OFFER message to DHCP RELAY, where the DHCP OFFER message is added with the Option 82;
4) DHCP RELAY, after receiving the DHCP OFFER message, deleting the Option82 added in the DHCP OFFER message, and sending the DHCP OFFER message with the Option82 deleted to the gateway;
5) the gateway sends a DHCP REQUEST message to DHCP RELAY after receiving the DHCP OFFER message;
6) DHCP RELAY, after receiving the DHCP REQUEST message from the gateway, adding an Option82 (a message name) to the DHCP REQUEST message, and sending the DHCPRrequest message added with the Option82 to the DHCP server in a unicast mode;
7) after receiving the DHCP REQUEST message added with the Option82 Option, the DHCP server sends a DHCP ACK message to DHCPRELAY, where the Option82 Option is added to the DHCP ACK message;
8) DHCP RELAY sends the IP address configured by the DHCP server to the DLNA client for the DLNA client to communicate.
Option82
1) The DLNA client broadcasts and sends a request message during initialization, wherein the request message does not contain option 82;
2) DHCP RELAY, the option82 is added to the tail of the received request message and then the message is relayed to the DHCP server. The sub-option of DHCP option82 may be, but is not limited to, interface information of the switch to which the gateway is connected;
3) after receiving the REQUEST message forwarded by DHCP RELAY, the DHCP server may allocate an IP address and other information according to the information carried by the option82 option in the REQUEST message and a predetermined policy, and then send a DHCP REQUEST message with DHCP configuration information and option82 information to DHCP RELAY.
4) DHCP RELAY, after receiving the DHCP REQUEST message from the DHCP server, it will strip the option82 information in the message, and then forward the message with DHCP configuration information to the gateway.
The application scenario of the present embodiment may be, but is not limited to: the DLNA client and the DLNA server are positioned in two different subnets, the DHCP server and the DLNA server can be positioned in the same subnet, and the gateway serves as a relay.
The embodiment provides a method for discovering a network media server based on DHCP, where an execution subject of the method is a DHCP device, as shown in fig. 1, the method may include:
101. the DHCP equipment determines a network media server communicating with the client according to the gateway position information acquired by the DHCP equipment and the network media server load information stored in the DHCP equipment;
102. and sending the address of the determined network media server to the gateway, so that the gateway sends the received related information of the determined network media server to the DLNA client after passing the authentication of the determined network media server, and the DLNA client communicates with the determined network media server.
After the scheme is adopted, the DHCP device determines a network media server which communicates with the client, and informs the gateway of the address and the port information of the network media server, and then the gateway initiates an authentication process to the network media server under the condition that the gateway does not receive a request which is sent by a Digital Living Network Alliance (DLNA) client and triggers the gateway to perform authentication; after the authentication is successful, the network media server returns specific related information, and finally the gateway informs the client of the related information of the network media server so that the client can communicate with the network media server, so that multicast message replication is not required to be supported by network equipment downwards from the network media server, and the requirement on multicast message replication of the network equipment downwards from the network media server is avoided; and meanwhile, the DHCP equipment determines the network media server which communicates with the client according to the acquired position information and the stored network media server load information, and when a plurality of network media servers exist on the network, the DHCP equipment can determine the network media server which is closer in position and smaller in load for the client so as to balance the load of the network media servers.
The embodiment provides another DHCP-based method for discovering a network media server, where an execution subject of the method is a gateway, as shown in fig. 2, the method may include:
201. the gateway sends an address allocation request to the DHCP device so that the DHCP device determines a network media server which communicates with the client according to the address allocation request;
202. receiving an address allocation response sent by the DHCP device, wherein the address allocation response comprises the address of the network media server determined by the DHCP device;
203. and the gateway sends an authentication request to the determined network media server under the condition that the gateway does not receive a request for triggering the gateway to authenticate sent by the DLNA client.
204. After passing the authentication of the determined network media server, receiving the determined related information of the network media server sent by the determined network media server;
205. and sending the determined network media server related information to the client so that the client can communicate with the determined network media server.
After the scheme is adopted, the DHCP device determines a network media server which communicates with the client, and informs the gateway of the address and the port information of the network media server, and then the gateway initiates an authentication process to the network media server under the condition that the gateway does not receive a request which is sent by a Digital Living Network Alliance (DLNA) client and triggers the gateway to perform authentication; after the authentication is successful, the network media server returns specific related information, and finally the gateway informs the client of the related information of the network media server so that the client can communicate with the network media server, so that multicast message replication is not required to be supported by network equipment downwards from the network media server, and the requirement on multicast message replication of the network equipment downwards from the network media server is avoided; and meanwhile, the DHCP equipment determines the network media server which communicates with the client according to the acquired position information and the stored network media server load information, and when a plurality of network media servers exist on the network, the DHCP equipment can determine the network media server which is closer in position and smaller in load for the client so as to balance the load of the network media servers.
The network media server may be, but is not limited to: a DLNA server or other HTTP (HTTP-hypertext transfer protocol) -based server, and the client may also be a client corresponding to the network media server. In the following embodiments, the network media server is taken as a DLNA server, and the client is taken as a DLNA client for explanation.
The present embodiment provides another DHCP-based method for discovering a network media server, which is a further extension of the methods shown in fig. 1 and fig. 2, where the DHCP device may be: in this embodiment, a DHCP device is taken as an example of a DHCP relay device. In order to make the present embodiment easier to understand, a data interaction diagram of the DHCP-based discovery network media server method of the present embodiment is provided as shown in fig. 3.
As shown in fig. 4, a flowchart of a method for discovering a network media server based on DHCP according to this embodiment is also provided.
Specifically, as shown in fig. 4, the present embodiment may specifically include:
401. the gateway sends an address assignment request to the DHCP relay device.
402. And the DHCP relay equipment receives an address allocation request sent by the gateway.
Before the DLNA client communicates with the network through the gateway (which may be, but is not limited to, a DLNA client), the gateway needs an IP address, and therefore, the DHCP relay device receives and forwards an address allocation request sent by the gateway to the DHCP server, so that the DHCP server allocates an IP address to the gateway.
Further, the address assignment request may include, but is not limited to: is a DHCP discovery message or a DHCP request message.
403. The DHCP relay adds option82 to the address allocation request and sends the address allocation request with the option82 added to the DHCP server so that the DHCP server allocates an address (i.e., an IP address) for the gateway for communication, and the option82 may include location information.
In this embodiment, the method for the DHCP server to allocate an address to the gateway is not limited, and is a technique well known to those skilled in the art, and will not be described herein again.
In this embodiment, the method for allocating an IP address to a gateway is not limited, and is a technique well known to those skilled in the art, and can be set according to actual needs, which is not described herein again.
404. And the DHCP relay equipment determines a network media server communicating with the client according to the gateway position information acquired by the DHCP equipment and the network media server load information stored in the DHCP equipment, and receives an address allocation response sent by the DHCP server.
The address assignment response may include, but is not limited to: the DHCP server assigns an IP address for the gateway for communication.
Further, the DHCP relay device may determine gateway location information according to a port number of a first port on the DHCP relay device, where the gateway location information includes the port number of the first port, or the gateway location information includes the port number of the first port and a board number of a board where the first port is located, or the gateway location information includes the port number of the first port, the board number of the board where the first port is located, and a frame number of a frame where the board is located.
As an implementation manner of this embodiment, the DHCP relay device may further add the acquired gateway location information to the corresponding option 82.
As an implementation manner of this embodiment, a method for the DHCP relay device to determine a network media server communicating with the DLNA client according to the acquired gateway location information and the stored network media server load information (that is, may be referred to as a DLNA server, and the following embodiments all take the DLNA server as an example for explanation) may be, but is not limited to: and the DHCP relay equipment acquires the DLNA server which is close to the gateway and has small load.
The DHCP relay equipment can replace a DLNA client and determine a DLNA server which communicates with the DLNA client according to the acquired address of the DLNA client and the stored network media server load information. Thus, compared with the prior art in which the DLNA client determines the DLNA server, the problem that the DLNA server needs to broadcast the services and other information which can be provided by the DLNA server to the DLNA client through the network device facing the DLNA server, so that the requirement on the network device is high is solved. Meanwhile, when at least one DLNA server exists in the system, the DHCP relay equipment can determine a DLNA server with a smaller load for the DLNA client according to the load information of the DLNA server, so that the load of the at least one DLNA server is more balanced.
In this embodiment, the method for acquiring the DLNA server is not limited, and may be set according to actual needs, which is not described herein again.
405. The DHCP relay device adds the determined address of the network media server to the address allocation response, and sends the address allocation response added with the determined address of the network media server to the gateway.
At this time, the address assignment response may further include: and the determined address of the network media server and the IP address allocated to the gateway for communication, namely the DHCP relay equipment sends the address of the gateway acquired based on DHCP to the gateway.
The address of the network media server may include, but is not limited to: the internet IP address of the network media server, or the address of the network media server, includes the internet IP address of the network media server and the port number of the port on the network media server that communicates with the client.
Further, the determined DLNA server address may be added to the DHCP ACK message and sent to the gateway, or may be sent to the gateway along with other messages. The DHCP ACK message has been introduced in the above description, and is not described herein again.
The method for sending the determined network media server information to the gateway in this embodiment is not limited, and may be set according to actual needs, which is not described herein again.
Furthermore, an option82 may be added to the received address allocation response sent by the DHCP server, and the option82 in the address allocation response is deleted before the DHCP relay sends the address allocation response to the gateway, that is, the option82 is not included in the address allocation response sent by the DHCP relay to the gateway.
406. And the gateway sends an authentication request to the determined network media server under the condition that the gateway does not receive a request for triggering the gateway to authenticate sent by the DLNA client.
407. And receiving the determined network media server related information sent by the determined network media server after the authentication of the determined network media server.
In this embodiment, the content included in the related information of the network media server is not limited, and may be set according to actual needs, for example, the content may include services that the network media server can provide, and the like, which are not described herein again.
The method for authenticating the gateway by the network media server is not limited in this embodiment, and is a technique well known to those skilled in the art, and will not be described herein again.
408. And the gateway sends the determined network media server related information to the DLNA client so that the DLNA client can communicate with the determined network media server.
Further, the method for sending the determined network media server-related information to the DLNA client may include:
multicasting and sending the determined related information of the network media server to the DLNA client; or,
and after receiving the request message, unicast-sending the determined related information of the network media server to the DLNA client side sending the request message.
The request message may include, but is not limited to: an SSDP m-search message (SSDP m-query message), etc., wherein the SSDP m-search message is defined in SSDP.
In this embodiment, the method for the gateway to send the determined network media server related information to the DLNA client is not limited, and may be set according to actual needs, which is not described herein again.
In this embodiment, the method for the DLNA client to communicate with the determined network media server is not limited, and is a technique well known to those skilled in the art, and may be set according to actual needs, which is not described herein again.
After the scheme is adopted, the DHCP device determines a network media server (namely a DLNA server) which communicates with the DLNA client, and informs the address and the port information of the DLNA server to the gateway, and then the gateway initiates an authentication process to the DLNA server under the condition that the gateway does not receive a request which is sent by the DLNA client and triggers the gateway to authenticate; after the authentication is successful, the DLNA server returns specific related information (such as Location, USN and the like), and finally the gateway informs the DLNA client of the related information of the network media server, so that the DLNA client communicates with the DLNA server, and therefore multicast message replication does not need to be supported by network equipment downwards from the DLNA server, and therefore the requirement on multicast message replication of the network equipment downwards from the DLNA server is avoided; and meanwhile, the DHCP equipment determines the DLNA server which communicates with the DLNA client according to the acquired position information and the stored load information of the DLNA server, and when a plurality of DLNA servers exist on the network, the DHCP equipment can determine the DLNA server which is closer in position and smaller in load for the DLNA client so as to perform load balancing on the DLNA server.
The embodiment provides another DHCP-based method for discovering a network media server, which is a further extension of the methods shown in fig. 1 and 2, and the main execution subject of the method is a DHCP server.
In order to make the present embodiment easier to understand, a data interaction diagram of the DHCP-based discovery network media server method of the present embodiment is provided as shown in fig. 5.
As shown in fig. 6, a flowchart of a method for discovering a network media server based on DHCP according to this embodiment is also provided.
As shown in fig. 6, may include:
601. the DHCP server receives the first address assignment request added with option82 sent by the DHCP relay device.
option82 may include: gateway location information.
The first address allocation request may include, but is not limited to: gateway location information of the gateway.
Gateway location information may include, but is not limited to: the DHCP relay equipment receives a port number of a first port of a second address allocation request sent by the gateway; or,
gateway location information may include, but is not limited to: the DHCP relay equipment receives a port number of a first port of a second address allocation request sent by the gateway and a single board number of a single board where the first port is located; or,
gateway location information may include, but is not limited to: the DHCP relay equipment receives the port number of the first port of the second address allocation request sent by the gateway, the single board number of the single board where the first port is located and the frame number of the frame where the single board is located.
The second address allocation request may be, but is not limited to, a DHCP discovery message sent by the gateway, and the first address allocation request may be, but is not limited to, a DHCP discovery message which is obtained according to DHCP and carries Option82 after the DHCP relay device receives the DHCP discovery message sent by the gateway;
or,
the second address allocation request may be, but is not limited to, a DHCP request message sent by the gateway, and the first address allocation request is a DHCP request message that is obtained by the DHCP relay device after receiving the DHCP request message sent by the gateway and carries the Option 82.
Furthermore, in order to enable the DHCP server to allocate an IP address to the gateway, the gateway sends an address allocation request to the DHCP relay device, and the DHCP relay device adds option82 to the address allocation request and sends the address allocation request to the DHCP server.
602. And the DHCP server determines a network media server for communicating with the client according to the gateway position information acquired by the DHCP server and the network media server load information stored in the DHCP server, and allocates an IP address for communication to the gateway.
Further, the DHCP device sends the address of the gateway obtained based on the DHCP to the gateway.
The DHCP server may not only allocate an IP address to the gateway, but also determine, instead of the DLNA client, a DLNA server that communicates with the DLNA client according to the gateway location information acquired from option82 and the stored network media server load information. Thus, compared with the prior art in which the DLNA client determines the DLNA server, the problem that the DLNA server needs to broadcast the services and other information which can be provided by the DLNA server to the DLNA client through the network device facing the DLNA server, so that the requirement on the network device is high is solved. Meanwhile, when at least one DLNA server exists in the system, the DHCP relay equipment can determine a DLNA server with a smaller load for the DLNA client according to the load information of the DLNA server, so that the load of the at least one DLNA server is more balanced.
In this embodiment, the method for allocating an IP address to a gateway is not limited, and is a technique well known to those skilled in the art, and can be set according to actual needs, which is not described herein again.
603. The DHCP server sends an address assignment response to the DHCP relay device.
The address assignment response may include, but is not limited to: the determined address of the network media server and the IP address allocated for the gateway for communication so that the DHCP relay device sends an address allocation response to the gateway.
Further, the address of the network media server may include, but is not limited to: the internet IP address of the network media server, or the address of the network media server, includes the internet IP address of the network media server and the port number of the port on the network media server that communicates with the client.
604. And the DHCP relay equipment sends an address allocation response to the gateway.
605. And the gateway sends an authentication request to the determined network media server under the condition that the gateway does not receive a request for triggering the gateway to authenticate sent by the DLNA client.
606. And receiving the determined network media server related information sent by the determined network media server after the authentication of the determined network media server.
607. And the gateway sends the determined network media server related information to the DLNA client so that the DLNA client can communicate with the determined network media server.
The detailed implementation of each step in this embodiment is similar to the implementation of the embodiment shown in fig. 5, and is not repeated here.
After the scheme is adopted, the DHCP device determines a network media server (namely a DLNA server) which communicates with the DLNA client, and informs the address and the port information of the DLNA server to the gateway, and then the gateway initiates an authentication process to the DLNA server under the condition that the gateway does not receive a request which is sent by the DLNA client and triggers the gateway to authenticate; after the authentication is successful, the DLNA server returns specific related information (such as Location, USN and the like), and finally the gateway informs the DLNA client of the related information of the network media server, so that the DLNA client communicates with the DLNA server, and therefore multicast message replication does not need to be supported by network equipment downwards from the DLNA server, and therefore the requirement on multicast message replication of the network equipment downwards from the DLNA server is avoided; and meanwhile, the DHCP equipment determines the DLNA server which communicates with the DLNA client according to the acquired position information and the stored load information of the DLNA server, and when a plurality of DLNA servers exist on the network, the DHCP equipment can determine the DLNA server which is closer in position and smaller in load for the DLNA client so as to perform load balancing on the DLNA server.
Some device embodiments are provided below, and the provided device embodiments correspond to the above method embodiments, and the implementation methods of the receiver, the determiner, the transmitter, and the like included in the device and the device are the same as the method described in the corresponding method embodiments.
The present embodiment provides a DHCP apparatus, as shown in fig. 7, which may include:
a processor 71, configured to determine, according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, a network media server communicating with the client;
a transmitter 72 for transmitting the determined address of the network media server to the gateway.
After the scheme is adopted, the determiner determines the network media server communicating with the client according to the gateway position information acquired by the DHCP device and the network media server load information stored in the DHCP device, the transmitter transmits the address of the determined network media server to the gateway, and then, the authentication process is initiated to the network media server under the condition that a request for triggering the gateway to authenticate sent by the DLNA client is not received; after the authentication is successful, the network media server returns specific related information, and finally the gateway informs the client of the related information of the network media server so that the client can communicate with the network media server, so that multicast message replication is not required to be supported by network equipment downwards from the network media server, and the requirement on multicast message replication of the network equipment downwards from the network media server is avoided; and meanwhile, the determiner determines the network media server which communicates with the client according to the acquired position information and the stored network media server load information, and when a plurality of network media servers exist on the network, the determiner can determine the network media server which is closer in position and smaller in load for the client so as to balance the load of the network media servers.
The embodiment provides another DHCP device, which is a further extension of the DHCP device shown in fig. 7, and as shown in fig. 8, the DHCP device may include:
a processor 81, configured to determine, according to the gateway location information obtained by the DHCP device and the network media server load information stored in the DHCP device, a network media server communicating with the client;
a transmitter 82 for transmitting the determined address of the network media server to the gateway.
Further, the DHCP device is a DHCP relay device or a DHCP server, wherein the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server, which communicates with the client.
Further, if the DHCP device is a DHCP relay device, the DHCP device further includes:
the receiver 83 is configured to receive an address allocation request sent by a gateway before the DHCP device determines a network media server communicating with a client according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, where the address allocation request is a DHCP discovery message or a DHCP request message;
the processor 81 is further configured to determine gateway location information according to a port number of a first port on the DHCP relay device, where the first port is used to receive an address allocation request, and the gateway location information includes the port number of the first port, or the gateway location information includes the port number of the first port and a board number of a board where the first port is located, or the gateway location information includes the port number of the first port, the board number of the board where the first port is located, and a frame number of a frame where the board is located.
Further, if the DHCP device is a DHCP server, the receiver 83 is further configured to receive a first address allocation request sent by the DHCP relay device before the DHCP device determines a network media server for communicating with the client according to gateway location information obtained by the DHCP device and network media server load information stored in the DHCP device, where the first address allocation request carries gateway location information of a gateway, and the gateway location information includes a port number of a first port where the DHCP relay device receives a second address allocation request sent by the gateway, or, the gateway location information includes the port number of the first port and the board number of the board where the first port is located, where the DHCP relay device receives the second address assignment request sent by the gateway, or, the gateway location information includes a port number of a first port, a board number of a board where the first port is located, and a frame number of a frame where the board is located, where the DHCP relay device receives a second address allocation request sent by the gateway;
the second address allocation request is a DHCP discovery message sent by the gateway, and the first address allocation request is a DHCP discovery message which is obtained by the DHCP relay equipment according to the DHCP and carries the Option82 after receiving the DHCP discovery message sent by the gateway;
or,
the second address allocation request is a DHCP request message sent by the gateway, and the first address allocation request is a DHCP request message which is obtained by the DHCP relay device after receiving the DHCP request message sent by the gateway and carries the Option 82.
Further, the network media server is a Digital Living Network Alliance (DLNA) server or a server based on a hypertext transfer protocol (HTTP); the client is a DLNA client;
and the transmitter 82 is further configured to transmit the address of the gateway obtained based on the DHCP to the gateway.
After the scheme is adopted, the determiner determines the network media server communicating with the client according to the gateway position information acquired by the DHCP equipment and the network media server load information stored in the DHCP equipment, the transmitter transmits the address of the determined network media server to the gateway, and then, the determiner initiates an authentication process to the DLNA server under the condition that a request for triggering the gateway to authenticate sent by the DLNA client is not received; after the authentication is successful, the DLNA server returns specific related information (such as Location, USN and the like), and finally the gateway informs the DLNA client of the related information of the network media server, so that the DLNA client communicates with the DLNA server, and therefore multicast message replication does not need to be supported by network equipment downwards from the DLNA server, and therefore the requirement on multicast message replication of the network equipment downwards from the DLNA server is avoided; and meanwhile, the determiner determines the DLNA server which communicates with the DLNA client according to the acquired position information and the stored load information of the DLNA server, and when a plurality of DLNA servers exist on the network, the determiner can determine the DLNA server which is closer in position and smaller in load for the DLNA client so as to perform load balancing on the DLNA server.
The present embodiment provides a gateway, as shown in fig. 9, which may include:
a transmitter 91 for transmitting an address assignment request to the DHCP apparatus; under the condition that a request for triggering a gateway to authenticate sent by a Digital Living Network Alliance (DLNA) client is not received, sending an authentication request to a determined network media server; sending the determined related information of the network media server to the DLNA client, wherein the determined related information of the network media server is used for responding to the registration request;
a receiver 92, configured to receive an address assignment response sent by the DHCP device, where the address assignment response includes an address of the network media server determined by the DHCP device; and receiving the determined network media server related information sent by the determined network media server after the authentication of the determined network media server.
Further, the transmitter 91 is specifically configured to multicast and transmit the determined network media server related information to the DLNA client; or after receiving the request message, unicast-sending the determined network media server related information to the DLNA client side sending the request message.
Further, the address of the network media server includes an internet IP address of the network media server, or the address of the network media server includes the internet IP address of the network media server and a port number of a port on the network media server for communicating with the client.
Further, the network media server related information includes: and determining the services which can be provided by the network media server.
The further address assignment response further comprises: and the DHCP equipment acquires the address of the gateway based on the DHCP.
After the scheme is adopted, the DHCP device determines a network media server (namely a DLNA server) which communicates with the DLNA client, and informs the address of the DLNA server and TCP port information to the gateway, and then the gateway initiates an authentication process to the DLNA server under the condition that the gateway does not receive a request which is sent by the DLNA client and triggers the gateway to authenticate; after the authentication is successful, the DLNA server returns specific related information (such as Location, USN and the like), and finally the transmitter informs the DLNA client of the related information of the network media server, so that the DLNA client communicates with the DLNA server, therefore, multicast message replication does not need to be supported by network equipment downwards from the DLNA server, and the requirement on multicast message replication of the network equipment downwards from the DLNA server is avoided; and meanwhile, the DHCP equipment determines the DLNA server which communicates with the DLNA client according to the acquired position information and the stored load information of the DLNA server, and when a plurality of DLNA servers exist on the network, the DHCP equipment can determine the DLNA server which is closer in position and smaller in load for the DLNA client so as to perform load balancing on the DLNA server.
The embodiment provides a system for discovering a network media server based on DHCP, as shown in fig. 10, which may include:
DHCP apparatus 101 and gateway 102 provided in the device embodiments.
The embodiments of the DHCP device 101 and the gateway 102 provided in this embodiment are the same as the embodiments of the DHCP device 101 and the gateway 102 provided in the foregoing apparatus embodiment, and are not described again here.
After the scheme is adopted, the DHCP device determines a network media server (namely a DLNA server) which communicates with the DLNA client, and informs the address and the port information of the DLNA server to the gateway, and then the gateway initiates an authentication process to the DLNA server under the condition that the gateway does not receive a request which is sent by the DLNA client and triggers the gateway to authenticate; after the authentication is successful, the DLNA server returns specific related information (such as Location, USN and the like), and finally the gateway informs the DLNA client of the related information of the network media server, so that the DLNA client communicates with the DLNA server, and therefore multicast message replication does not need to be supported by network equipment downwards from the DLNA server, and therefore the requirement on multicast message replication of the network equipment downwards from the DLNA server is avoided; and meanwhile, the DHCP equipment determines the DLNA server which communicates with the DLNA client according to the acquired position information and the stored load information of the DLNA server, and when a plurality of DLNA servers exist on the network, the DHCP equipment can determine the DLNA server which is closer in position and smaller in load for the DLNA client so as to perform load balancing on the DLNA server.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus necessary general hardware, and certainly may also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present invention may be substantially implemented or a part of the technical solutions contributing to the prior art may be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a hard disk, or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.