You can easilly use my demo-project as a simple test, even if you don't know the IP address of the server (this is perhaps also nice info for others that have downloaded the demo).
Simply use the broadcast-address for your network-range; if you're on the 192.168.1.x subnet use address 255 as the destination, ie. 192.168.1.255 and all PC's on that subnet (including your server) will receive that message. Greetz and good luck, Peter. -----Oorspronkelijk bericht----- Van: [email protected] [mailto:[EMAIL PROTECTED] Paul Bennett Verzonden: donderdag 17 juli 2008 15:17 Aan: [email protected] Onderwerp: RE: [delphi-en] UDP Broadcast > ----- Original Message ----- > From: "Peter Luijer" <[EMAIL PROTECTED]> > To: [email protected] > Subject: RE: [delphi-en] UDP Broadcast > Date: Wed, 16 Jul 2008 19:22:26 +0200 > > > The first thing I want to know is why you want to use UDP, while you're > expecting > a reply from the client... Why not simply use TCP, which will automatically > give > you a reply if it's able to connect. Because I don't know the IP address of the server! Hence the broadcast. > > It should be possible to use UDP though, I made a very simple demo-chat > application > a while ago with only a few lines of code, just to let others see how to use > TIdUDP. > If you want a copy, just ask and I'll put it on-line again. > > Greetz, > > Peter. I've found a UDP Client/Server demo which shows me what I need to do, but, although demo compiles and runs OK, I can't get the code to run in my application. - I think I may have a problem with Delphi itself(!) as I have been getting strange error messages for some time now. I'm going to un/re-install Delphi and see if that will cure my problems. Paul. > > -----Oorspronkelijk bericht----- > Van: [email protected] [mailto:[EMAIL PROTECTED] > Paul Bennett > Verzonden: woensdag 16 juli 2008 11:24 > Aan: [email protected] > Onderwerp: [delphi-en] UDP Broadcast > > > I'm having real problems with this (which I'm sure is actually really > easy). > > I'm working on a Client/Server application which will be running over > our LAN. What I would like to do is when a Client starts up it sends a > UDP broadcast to a specific Port which is being monitored by the > Server app. When the server gets the broadcast it responds by sending > a UDP message back to the originating client containing the servers IP > address. > > All future traffic between Client and Server would then be Peer to > Peer across TCP/IP. > > I have created two test apps, one broadcasts the UDP message (Client) > and the other (Server) should respond, both apps contain UDPServer and > UDPClient components. My problem is that the Server > never seems to receive the Message. > > Can anyone either point me to some code that works that I could use > that as my starting point, or explain, in words of one syllable how to > achieve my aim? > > TIA > > Paul > > > > > > > [Non-text portions of this message have been removed] > Experience is something you don't get until just after you need it.

