Can Torque tell me my local IP address?
by Ritchey "Hawk" Mulhollem · in Torque Game Engine · 09/23/2004 (3:36 pm) · 16 replies
I see you can .getAddress() for clients, but how do I find out my own?
#2
Yeah, that's an idea. I can open a socket and pull the info that way. I can't believe Torque doesn't have a predefined variable for that? But who am I kidding, Torque script is weird. They have a "getfields" command (similar to a split command in javascript or perl) and hard coded it to split only on a space! Why!? WHY!? WHY!!??
Oh, well. Thanks for the rapid reply, that does help.
:>
09/23/2004 (4:04 pm)
IT'S YOU!!! I've been dissecting your code and admiring your work. I've learned a lot from your stuff! I've visited your website but you have no email address there so I had no way to say thanks.Yeah, that's an idea. I can open a socket and pull the info that way. I can't believe Torque doesn't have a predefined variable for that? But who am I kidding, Torque script is weird. They have a "getfields" command (similar to a split command in javascript or perl) and hard coded it to split only on a space! Why!? WHY!? WHY!!??
Oh, well. Thanks for the rapid reply, that does help.
:>
#3
If you know you're doing a LAN connection, that should be fine you could probably get your IP or IPX address, but when you're talking about getting your internet IP address... NAT is just too popular with all the Linksys, DLink and Netgear equipment out there..
09/23/2004 (4:27 pm)
The problem with getting your local IP using sockets etc... well what if you're behind a NAT?If you know you're doing a LAN connection, that should be fine you could probably get your IP or IPX address, but when you're talking about getting your internet IP address... NAT is just too popular with all the Linksys, DLink and Netgear equipment out there..
#4
But, is there a way to obtain the local IP at all?
09/23/2004 (5:25 pm)
That's a very good point. I would need to obtain it from both points and compare them. If they are different I know I need to prompt the user for the correct one. But, is there a way to obtain the local IP at all?
#5
09/28/2004 (11:58 pm)
127.0.0.1 ?
#6
09/29/2004 (12:32 am)
Lol, that or localhost?
#7
Local IP address refers to MY IP address as others on the local LAN would see it. IE: 192.168.0.1 Such as that which would be assigned by a wireless router.
Posting a response of "Just use 127.0.0.1 or LocalHost!" is just making an ass of yourself. Why don't you try to actually READ my post instead of doing what you can to make fun of it.
Be part of the solution, not the problem!!!
09/29/2004 (6:01 am)
If you people have nothing useful to add then I would appreciate it if you would not post anything at all! Local IP address refers to MY IP address as others on the local LAN would see it. IE: 192.168.0.1 Such as that which would be assigned by a wireless router.
Posting a response of "Just use 127.0.0.1 or LocalHost!" is just making an ass of yourself. Why don't you try to actually READ my post instead of doing what you can to make fun of it.
Be part of the solution, not the problem!!!
#8
If anyone knows a way to do "serverConnection.getAddress()" please share!
Thanks!
09/29/2004 (6:07 am)
LabRat, I did what you suggested. I have it contacting my webserver and I wrote a Perl script that kicks back the connecting IP address. So I can now tell my external IP. Still, the original problem remains. How do I obtain the local IP address on the box itself.If anyone knows a way to do "serverConnection.getAddress()" please share!
Thanks!
#9
On the server side, after connect, simply call:
Unless I'm misunderstanding the problem somewhere...
Ian
09/29/2004 (7:06 am)
On the client side:clientCmdSetIP(%ip)
{
$myIP = %ip;
}On the server side, after connect, simply call:
commandToClient(%client, %client.getAddress());
Unless I'm misunderstanding the problem somewhere...
Ian
#10
You know how you can boot it into dedicated mode? Well, I need a way of publishing that IP address out to clients.
I've designed my own master server system since GG does not provide their master server code. Besides, my code is far superior to theirs. I'll be giving it away for free as soon as I have it working the way I like.
09/29/2004 (7:53 am)
I need to do: %server.getAddress(); You know how you can boot it into dedicated mode? Well, I need a way of publishing that IP address out to clients.
I've designed my own master server system since GG does not provide their master server code. Besides, my code is far superior to theirs. I'll be giving it away for free as soon as I have it working the way I like.
#11
09/29/2004 (8:10 pm)
It would probably be better for your master server to determine the ip address of the server you want to add.
#12
09/29/2004 (11:56 pm)
Ritchey: Not trying to be funny - just misunderstood what you wanted. You did say you wanted your local IP address after all, and there's no safe way of seeing what your IP address looks like from the outside world without going to the outside world and looking back in. I'd go with Blake's suggestion, personally.
#13
09/30/2004 (4:49 am)
I agree with you both. This is the route I am going to take. I'll have an edit box so they can change it if need be. Thanks for all the help!
#14
1.Start->Run->cmd prompt
2.In that,just type ipconfig and then click enter
For example: It will show ip address like 74.110.208.65 .
You can also check your IP address by using Ip-details.com .
02/12/2014 (11:27 pm)
Steps to be followed for finding your computer's ip address in Windows XP/Vista:1.Start->Run->cmd prompt
2.In that,just type ipconfig and then click enter
For example: It will show ip address like 74.110.208.65 .
You can also check your IP address by using Ip-details.com .
#15
But that's not terribly useful from within the engine - you'd have to execute the command from within the game and have it dump to a text file, then use another script to scrape the text file for the information you're looking for.
<edit>
I take it back - you should be able to get that info in a buffer from popen() thereby bypassing the "dump to text file/read back in" steps. But again, you have to write your own console function for it.
02/13/2014 (4:24 pm)
Ok, that's some serious necromancy there.But that's not terribly useful from within the engine - you'd have to execute the command from within the game and have it dump to a text file, then use another script to scrape the text file for the information you're looking for.
<edit>
I take it back - you should be able to get that info in a buffer from popen() thereby bypassing the "dump to text file/read back in" steps. But again, you have to write your own console function for it.
#16
It is 3422 days from the start date to the end date, but not including the end date
Or 9 years, 4 months, 13 days excluding the end date
Alternative time units
3422 days can be converted to one of these units:
295,660,800 seconds
4,927,680 minutes
82,128 hours
3422 days
488 weeks (rounded down)
Holy sweet necro....
02/17/2014 (8:29 am)
Result: 3422 daysIt is 3422 days from the start date to the end date, but not including the end date
Or 9 years, 4 months, 13 days excluding the end date
Alternative time units
3422 days can be converted to one of these units:
295,660,800 seconds
4,927,680 minutes
82,128 hours
3422 days
488 weeks (rounded down)
Holy sweet necro....
Torque Owner Harold "LabRat" Brown
Of course that would give you your Internet IP address...
Locally... well that's a different fish