BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

locate server on LAN

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Eugene V. Goldberg
Guest





PostPosted: Sat Jan 17, 2004 11:45 am    Post subject: locate server on LAN Reply with 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.


Back to top
Claire
Guest





PostPosted: Tue Jan 20, 2004 12:42 am    Post subject: Re: locate server on LAN Reply with quote




"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





PostPosted: Tue Jan 20, 2004 4:59 am    Post subject: Re: locate server on LAN Reply with quote



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





PostPosted: Tue Jan 20, 2004 8:56 am    Post subject: Re: locate server on LAN Reply with 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





PostPosted: Tue Jan 20, 2004 10:14 am    Post subject: Re: locate server on LAN Reply with quote

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





PostPosted: Tue Jan 20, 2004 10:26 am    Post subject: Re: locate server on LAN Reply with 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.

"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





PostPosted: Tue Jan 20, 2004 6:55 pm    Post subject: Re: locate server on LAN Reply with quote


"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.