Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Get IP of server application

I want to program a game which can play over internet. This problem is like a client/server application. For client can be connected to server, it have to know IP of server. So IP is dynamic (supply by ISP) that I have a question:
Is there any away to know IP of computer when it connect to internet?
(or Is there any ISP supply IP of users when these users access to it?
0
cdr_10
Asked:
cdr_10
  • 4
  • 4
1 Solution
 
ozoCommented:
Internet Protocol?
See RFC 1180.
Or for the new IPv6, try RFC 1752
0
 
cdr_10Author Commented:
Sorry,
IP address.
0
 
arbitraryCommented:
If you plan to initiate the connection yourself Using the RAS Api
you can obtain the IP or you can gethostbyname
with winsock functions like that:

hostent *pEntry;
char name[BUFFERLENGTH]
if gethostname (name,BUFFERLENGTH);
then
pEntry = *gethostbyname(name);

the trick is informing the two players of each other's IP's
U can Broadcast in LAN or use a third server which will notify
the two players of each other's server IP address.


0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
cdr_10Author Commented:
Thank,

Gethostname get only my IP address but I want to get IP address of other side.

I can't Broadcast in LAN because my question is: play over Internet.

How can I do with third server? Where is third server?
0
 
arbitraryCommented:
it's like trying to call a phone number of someone to ask what is their phonenumber you can't do that ....
you need information service that has the IP's of the the players....
for example  my name is XXXX23234 I want to play  with 230495823
I send the server my IP address the server send it to 230495823
if 230495823 wanna play with me he can play he will send me his IP and let the game begin.
without the third server you don't have aa method  of locating this user over the internet on RT.

so I deserve my points or should I write a small program that will demonstrate it for you?

0
 
cdr_10Author Commented:
I'm sorry because of rejected your answer. I understood what you say but I want to know where I can find "third server". I think this server have to list all of user's IP online. Sorry because of my dulness.
Help me.
0
 
arbitraryCommented:
actually the this third server should be located on a machine with a static ip / DNS file  so it could be reached .
in any case you want two people to play through the net they have to chat first,or to know they want to play with each-other,
which means that you'll need a web server to manage gatherings of people on any case you can use this server to implement this
'routing server' which it's purpose is to identify each player
or programatically -> to Identify each server to each client
through this 'routing server' is it clearer?

0
 
arbitraryCommented:
take for exapmple ICQ ....
you connect to the internet get an IP,
and then you connect to their server (icq.mirabillis.com for example)
sendnig Identity packet , and within this packet there is information s.a.  IP. etc...etc...etc...etc...
it it's still a bit vague  try reading a book about TCP/IP.

0
 
cdr_10Author Commented:
Thank you very much for every thing you help me.
I found what I looking for: www.mirabilis.com with ICQ.

Hope see you again.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now