Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a client-server application, which runs in a LAN.

Every time a device connects to this LAN, it should send some data to the server within the LAN, but the device doesn't know the IP address of the server.

Is it possible to solve this with port forwarding?


EDIT:

The devices are android devices, they collect some data in the background and then send it to the server application, which is a java application, and it consumes the data.

As I said, I'm pretty new to networking, and I found some stuff about port forwarding, but it didn't seem to help me. This is why I asked you guys.

Could you explain please this simple name resolution?

Thanks

share|improve this question
    
Where do they connect to? Some kind of router? –  slhck Apr 21 '12 at 10:19
    
to the wifi router, sorry. –  bicska88 Apr 21 '12 at 10:20

1 Answer 1

up vote 1 down vote accepted

If you don't know the IP address of the target device, you can only work with UDP broadcasts.

Send one packet to the entire network, wait for the answer from the host. Now you know the IP address of the host.

share|improve this answer
    
Couldn't you also use name resolution in Android? –  slhck Apr 21 '12 at 10:53
    
I assumed the name of the target is also unknown. If the name is known, then, yes, by all means, a simple DNS query solves the problem. –  Oliver Salzburg Apr 21 '12 at 10:56
    
Thanks, this really solves my problem. –  bicska88 Apr 21 '12 at 11:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.