Tuesday, March 17, 2020

Free Essays on DHCP

Although a single DHCP server can support a network of any size, it is often useful to have two. Here's what happens when a DHCP client enters the network: 1. The client broadcasts a DHCP discover message that is forwarded to DHCP servers on the network. 2. Each DHCP server that receives the discover message responds with a DHCP offer message that includes an IP address that is appropriate for the subnet where the client is attached. 3. The client considers the offer message and selects one. It sends a request to use that address to the DHCP server that originated the offer. 4. The DHCP server acknowledges the request and grants the client a lease to use the address. 5. The client uses the IP address to bind to the network. If the IP address is associated with any configuration parameters, the parameters are incorporated into the client's TCP/IP configuration. In step 1 I told you that DHCP clients request their addresses using broadcast messages. The preceding chapters have pointed out several times that broadcast messages don't cross TCP/IP routers. Does that mean that a DHCP client can't obtain an IP address from a DHCP server on another subnet? No, not if you configure routers with the BOOTP protocol. BOOTP is an older protocol that assigns IP addresses, and it remains in use to allow DHCP broadcasts to propagate across routers. Thanks to BOOTP, a DHCP server can service clients on any number of subnets. In Figure 14.17, BOOTP is enabled on the router, which must, of course, be configured to route TCP/IP traffic. When the client broadcasts a request for an IP address, BOOTP receives the request and sends a directed message to any DHCP server that it knows about. This allows a DHCP server on a remote subnet to receive the request. The DHCP server responds through a directed message, so there is no problem with routing the response back to the client.... Free Essays on DHCP Free Essays on DHCP Although a single DHCP server can support a network of any size, it is often useful to have two. Here's what happens when a DHCP client enters the network: 1. The client broadcasts a DHCP discover message that is forwarded to DHCP servers on the network. 2. Each DHCP server that receives the discover message responds with a DHCP offer message that includes an IP address that is appropriate for the subnet where the client is attached. 3. The client considers the offer message and selects one. It sends a request to use that address to the DHCP server that originated the offer. 4. The DHCP server acknowledges the request and grants the client a lease to use the address. 5. The client uses the IP address to bind to the network. If the IP address is associated with any configuration parameters, the parameters are incorporated into the client's TCP/IP configuration. In step 1 I told you that DHCP clients request their addresses using broadcast messages. The preceding chapters have pointed out several times that broadcast messages don't cross TCP/IP routers. Does that mean that a DHCP client can't obtain an IP address from a DHCP server on another subnet? No, not if you configure routers with the BOOTP protocol. BOOTP is an older protocol that assigns IP addresses, and it remains in use to allow DHCP broadcasts to propagate across routers. Thanks to BOOTP, a DHCP server can service clients on any number of subnets. In Figure 14.17, BOOTP is enabled on the router, which must, of course, be configured to route TCP/IP traffic. When the client broadcasts a request for an IP address, BOOTP receives the request and sends a directed message to any DHCP server that it knows about. This allows a DHCP server on a remote subnet to receive the request. The DHCP server responds through a directed message, so there is no problem with routing the response back to the client....

Sunday, March 1, 2020

Coloring the TDBGrid Delphi Component

Coloring the TDBGrid Delphi Component Adding color to your database grids will enhance the appearance and differentiate the importance of certain rows or columns within the database. Well do this by focusing on DBGrid, which provides a great user interface tool for displaying data. Well assume that you already know how to connect a database to a DBGrid component. The easiest way to accomplish this is to use the Database Form Wizard. Select the employee.db from the DBDemos alias and select all fields except EmpNo. Coloring Columns The first and easiest thing you can do to visually enhance the user interface is to color individual columns in the data-aware grid. Well accomplish this through the TColumns property of the grid. Select the grid component in the form and invoke the Columns editor by double-clicking the grids Columns property in the Object Inspector. The only thing left to do is specify the background color of the cells for any particular column. For text  foreground color, see the font property. Tip: For more information on Columns editor, look for Columns editor: creating persistent columns in your Delphi help files. Coloring Rows If you want to color the selected row in a DBGrid but you dont want to use the dgRowSelect option (because you want to be able to edit the data), you should instead use the DBGrid.OnDrawColumnCell event. This technique demonstrates how to dynamically change the color of text in a DBGrid: procedure TForm1.DBGrid1DrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif Table1.FieldByName(Salary).AsCurrency36000 then DBGrid1.Canvas.Font.Color:clMaroon;DBGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);end; Heres how to dynamically change the color of  a row in a DBGrid: procedure TForm1.DBGrid1DrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif Table1.FieldByName(Salary).AsCurrency36000 then DBGrid1.Canvas.Brush.Color:clWhite;DBGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);end; Coloring Cells Finally, heres how to change the background color of the cells of any particular column, plus the text foreground color: procedure TForm1.DBGrid1DrawColumnCell (Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);beginif Table1.FieldByName(Salary).AsCurrency40000 thenbegin DBGrid1.Canvas.Font.Color:clWhite; DBGrid1.Canvas.Brush.Color:clBlack;end;if DataCol 4 then //4 th column is Salary DBGrid1.DefaultDrawColumnCell (Rect, DataCol, Column, State);end; As you can see, if an employees salary is greater than 40 thousand, its Salary cell is displayed in black and the text is displayed in white.