Dan Rosenstark
Dan Rosenstark

Reputation: 69747

Discover a TCP/IP Socket?

I am using Objective-C and Java for this, but I think the question is language-neutral.

I have an iOS client that talks to a Java server over TCP/IP. Right now I need to tell at least one of the parties the IP address of the other. Is there a standard way that I can "discover" IP addresses (from one side or the other)?

Also, how would switching to UDP affect the answer?

Upvotes: 2

Views: 1555

Answers (3)

dty
dty

Reputation: 18998

Why can't the server have a well known DNS name?

Upvotes: 0

S.Lott
S.Lott

Reputation: 391818

Is there a standard way that I can "discover" IP addresses (from one side or the other)?

Yes, it's called "port sniffing" and will certainly get you in trouble since it's a common kind of attack.

You simply try all IP addresses in a range. Many firewall products will consider this an "intrusion" attempt and log you with the intrusion detection software.

We almost never "discover" addresses.

That's what "domain names" are for.

Upvotes: 0

Darron
Darron

Reputation: 21618

There are many protocols for discovering other devices/servers on the network. One of the most commonly used in the iOS realm is "Bonjour". Look at Apple's sample apps.

Upvotes: 5

Related Questions