 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Eugene V. Goldberg Guest
|
Posted: Sat Jan 17, 2004 11:45 am Post subject: locate server on LAN |
|
|
I have a server application on LAN listening on some port,
but i dont know IP...
I know this can be done with UDP broadcast...Any samples?
Thanx,
Eugene.
|
|
| Back to top |
|
 |
Claire Guest
|
Posted: Tue Jan 20, 2004 12:42 am Post subject: Re: locate server on LAN |
|
|
"Eugene V. Goldberg" <egold (AT) mts-nn (DOT) ru> wrote
| Quote: | I have a server application on LAN listening on some port,
but i dont know IP...
I know this can be done with UDP broadcast...Any samples?
Thanx,
Eugene.
From the client, UDP broadcast a message to ip address 255.255.255.255 to |
whichever port the server is listening. The server should then reply so that
the client can pick up the IP address of the server. Only use this method
during discovery then swap to the real IP/port later to keep the network
traffic to a minimum.
|
|
| Back to top |
|
 |
Eugene V. Goldberg Guest
|
Posted: Tue Jan 20, 2004 4:59 am Post subject: Re: locate server on LAN |
|
|
How i can do that with Indy UDP components?
"Claire" <corky (AT) corkyscave (DOT) com> wrote
| Quote: |
"Eugene V. Goldberg" <egold (AT) mts-nn (DOT) ru> wrote in message
news:40092061 (AT) newsgroups (DOT) borland.com...
I have a server application on LAN listening on some port,
but i dont know IP...
I know this can be done with UDP broadcast...Any samples?
Thanx,
Eugene.
From the client, UDP broadcast a message to ip address 255.255.255.255 to
whichever port the server is listening. The server should then reply so
that
the client can pick up the IP address of the server. Only use this method
during discovery then swap to the real IP/port later to keep the network
traffic to a minimum.
|
|
|
| Back to top |
|
 |
Claire Guest
|
Posted: Tue Jan 20, 2004 8:56 am Post subject: Re: locate server on LAN |
|
|
Ive posted a little demo source on the attachment group
for Eugene V Goldberg
Hope this helps
|
|
| Back to top |
|
 |
Eugene V. Goldberg Guest
|
Posted: Tue Jan 20, 2004 10:14 am Post subject: Re: locate server on LAN |
|
|
Thanx alot Claire!
"Claire" <corky (AT) corkyscave (DOT) com> wrote
| Quote: | Ive posted a little demo source on the attachment group
for Eugene V Goldberg
Hope this helps
|
|
|
| Back to top |
|
 |
Eugene V. Goldberg Guest
|
Posted: Tue Jan 20, 2004 10:26 am Post subject: Re: locate server on LAN |
|
|
Claire,
I think instead of
Str := UDPClient.ReceiveString(IP,Port,2);
it should be
Str := UDPClient.ReceiveString(IP,12345,2);
since Port is not assigned anywhere.
Dont i need to set BroadcastEnabled to True?
Eugene.
"Claire" <corky (AT) corkyscave (DOT) com> wrote
| Quote: | Ive posted a little demo source on the attachment group
for Eugene V Goldberg
Hope this helps
|
|
|
| Back to top |
|
 |
Claire Guest
|
Posted: Tue Jan 20, 2004 6:55 pm Post subject: Re: locate server on LAN |
|
|
"Eugene V. Goldberg" <egold (AT) mts-nn (DOT) ru> wrote
| Quote: | Claire,
I think instead of
Str := UDPClient.ReceiveString(IP,Port,2);
it should be
Str := UDPClient.ReceiveString(IP,12345,2);
since Port is not assigned anywhere.
Dont i need to set BroadcastEnabled to True?
Eugene.
|
Hi Eugene, sorry for the delay in replying.
I thought, as you mentioned, that BroadcastEnabled should be true but it
seemed to work either way. Of course I was only running it on my local
machine and it may work different across a network.
IP and Port are var parameters and return the IP and Port of the machine
that sent the message to the UDPClient , so you don't initialize them.
When Ive used this method in the past, I use the UDP discovery port purely
for this task (enabling and disabling as I need it) and do the real
communication through a different set of controls/ports. I ignored the
value returned in the Port variable above as I'm only interested in the IP
address of the server.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|