Solved

Get IP of server application

Posted on 1998-08-30
9
202 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
  • 4
  • 4
9 Comments
 
LVL 84

Expert Comment

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

Author Comment

by:cdr_10
Comment Utility
Sorry,
IP address.
0
 
LVL 1

Expert Comment

by:arbitrary
Comment Utility
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
 

Author Comment

by:cdr_10
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Expert Comment

by:arbitrary
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now