Important Procedures for an Internet Access Control Application - Taking Names
(Page 2 of 5 )
The ‘compname’ variable will take the workstation's name (that is the actual name of the computer that is connecting). At the moment it is commented out for debugging purposes; be sure to uncomment this line when you test the application.
//compname:= GStack.HostByAddress(IP);
The next line of code reads the communication that is sent by the workstation. This will include the name of the workstation. Currently the name is filled in manually, but it will be automatically filled in when you uncomment the line above.
str:=Connection.IOHandler.ReadLn;
//GetComputername+':free@plchldr'
The string is then parsed into different sections using the parse function:
parsestring(str,cmdrslt,cmd,placeholder);
The computer name is then stored in the compname variable:
compname:=cmdrslt;
Then the code checks to see if the name was actually sent. If so, the list view component is updated accordingly:
if compname <> '' then
begin
li:=lv.Items.Add;
li.ImageIndex:=0;
li.Caption:=cmdrslt;
li.SubItems.Add('-');
li.SubItems.Add('-');
li.SubItems.Add('-');
li.SubItems.Add('-');
li.SubItems.Add(cmd);
end else
Next: Disconnecting from the Server >>
More Delphi-Kylix Articles
More By David Web