Solved

Get IP of server application

Posted on 1998-08-30
9
207 Views
Last Modified: 2010-04-02
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
Comment
Question by:cdr_10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1171640
Internet Protocol?
See RFC 1180.
Or for the new IPv6, try RFC 1752
0
 

Author Comment

by:cdr_10
ID: 1171641
Sorry,
IP address.
0
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171642
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cdr_10
ID: 1171643
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
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171644
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
 

Author Comment

by:cdr_10
ID: 1171645
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
 
LVL 1

Expert Comment

by:arbitrary
ID: 1171646
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
 
LVL 1

Accepted Solution

by:
arbitrary earned 100 total points
ID: 1171647
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
 

Author Comment

by:cdr_10
ID: 1171648
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Fully specialized class template function 21 155
convert char array to number in c 5 93
Microsoft C++ code failing in executable that worked 9 138
What is sub-make ? 2 102
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question