Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Oct : LAN Connections with IdTCPServer and IdTCPClient and Broadcast
| Subject: | LAN Connections with IdTCPServer and IdTCPClient and Broadcast |
| Posted by: | "Klaus Dewald" (klaus.dewa..@efasoftware.de) |
| Date: | Fri, 28 Oct 2005 14:34:32 |
Hi all,
i want to use a TIdTCPServer and a TIdTCPClient in the same program.
When the program starts it put itself into the system tray and wait
there. Now i want to broadcast all LAN PC's if there is the same program
running. If yes, then the tcpserver inside has to return a number or a
string or anything else. In the Program where the tcpclient start the
broadcast all answers had to be received and execute some code depend on
the answers.
In the help of Indy 10 i found this code for the server. That should be
working.
procedure TMainForm.IdTCPServer1Execute(AContext: TIdContext);
Var lCmd : String;
begin
lCmd := Trim(AContext.Connection.IOHandler.ReadLn);
If AnsiSameText(lCmd,'GIVENUMBER') then
AContext.Connection.IOHandler.WriteLn(IntToStr(nAnswer));
If AnsiSameText(lCmd,'THANKYOU') then
AContext.Connection.Disconnect;
end;
That seems to be simple but how can i receive multiple answers in short
time with the tcpclient?
How can i made a broadcast with the tcpclient(i believe
host='255.255.255.255')?
What is the needed reaction for the tcpserver on the broadcast?
I used D6 with Indy 10 on W2K SP4
I hope you understand and can help me.
Thanks in advance
Klaus Dewald