ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 21st, 2005, 03:37 PM
tac's Avatar
tac tac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 187 tac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 10 m 5 sec
Reputation Power: 6
Find Coldfusion Server's IP Address

How can I find the IP address of the server?

The IP address of the client can by found by:
Code:
#CGI.REMOTE_ADDR#


Does there happen to be a coldfusion tag like:
Code:
<cfoutput>#serverAddress()#</cfoutput>
<!--- Output's 192.168.2.2 --->

Reply With Quote
  #2  
Old July 21st, 2005, 03:54 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
cflib.org is your friend!

http://www.cflib.org/udf.cfm?ID=1003
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old July 21st, 2005, 04:05 PM
tac's Avatar
tac tac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 187 tac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 10 m 5 sec
Reputation Power: 6
Nice Find!

So you can you basically run anything you an write in java through coldfusion? Hmm... I'm better at java than coldfusion.

Reply With Quote
  #4  
Old July 21st, 2005, 04:11 PM
tac's Avatar
tac tac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 187 tac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 10 m 5 sec
Reputation Power: 6
Hmm... Intresting.

Apprently the IP address the server is using to connect to itself is not the same IP address that is returned by that function. Do you know of other functions like that for me to test out?

Reply With Quote
  #5  
Old July 21st, 2005, 04:12 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
You can poke around on cflib.org, but yes, if you know Java then you can invoke any Java API methods from within CF. So you might check out the related Java methods as well.

Reply With Quote
  #6  
Old July 21st, 2005, 04:40 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
<cfexecute name = "C:\WinNT\System32\ipconfig.exe"
arguments = "/all"
variable ="crpa"
timeout = "1">
</cfexecute><Cfoutput>#crpa#</Cfoutput>


check your path to ipconfig...

Reply With Quote
  #7  
Old July 21st, 2005, 04:47 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
or the long way

import java.net.*;

public class Url001{
public static void main(String[] args){
try{
System.out.println(
"Get and display IP address of URL by name");
InetAddress address = InetAddress.getByName(
"forums.devshed.com");
System.out.println(address);

System.out.println(
"Do reverse lookup on the IP address");
//Extract the IP address from the string to the right
// of the /. Then provide the IP address as a string
// to the getByName() method.
int temp = address.toString().indexOf('/');
address = InetAddress.getByName(
address.toString().substring(temp+1));
System.out.println(address);

System.out.println(
"Get and display current IP address of LocalHost");
address = InetAddress.getLocalHost();
System.out.println(address);

System.out.println(
"Do reverse lookup on current " +
"IP address of LocalHost");
temp = address.toString().indexOf('/');
address = InetAddress.getByName(
address.toString().substring(temp+1));
System.out.println(address);

System.out.println(
"Get and display current name of LocalHost");
System.out.println(address.getHostName());

System.out.println(
"Get and display current IP address of LocalHost");

//Get IP address as an array of bytes.
byte[] bytes = address.getAddress();

//Convert IP address bytes to unsigned values
// and display separated by spaces.
for(int cnt = 0; cnt < bytes.length; cnt++){
int uByte =
bytes[cnt] < 0 ? bytes[cnt] + 256 : bytes[cnt];
System.out.print(uByte + " ");
}//end for loop
System.out.println();
}catch(UnknownHostException e){
System.out.println(e);
System.out.println("Must be online to run properly.");
}//end catch
}//end main
}//end class Url001


of course you will want to CreateObject() then invoke whatever function you want to use in the .class file

Reply With Quote
  #8  
Old July 22nd, 2005, 01:38 PM
tac's Avatar
tac tac is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 187 tac User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 10 m 5 sec
Reputation Power: 6
My server has multiple IP addresses, 6 to be exact, so I developed the following script to check IP config to determine if the server was connecting to itself. It might be more appropriate to check for someting like "IP Address:.........#CGI.REMOTE_ADDR#" rather than just "#CGI.REMOTE_ADDR", but i knew I wouldn't have to wory about a DNS or IP address Mask connecting to the server and breaking my code.

Also the second script provided by falcon only returns one of the 6 IP addresses.

Code:
<!--- Verify Server is Connecting from Itself --->
<cffunction name="verifyServer">
	
	<!--- Pull IP addresses from Windows IPConfig.exe --->
	<cfexecute
	 name = "C:\WINDOWS\system32\ipconfig.exe"
	 arguments = "/all" 
	 variable ="IPs"
	 timeout = "1"
	>
	</cfexecute>
	
	<!--- Check if Connecting Address is an IP of the Server --->
	<cfif findNoCase(CGI.REMOTE_ADDR, variables.IPs) EQ 0>
		<!--- Server is NOT connecting to itself --->
		<cfreturn 0>
	<cfelse>
		<!--- Server IS connecting to itself --->
		<cfreturn 1>
	</cfif>
</cffunction>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Find Coldfusion Server's IP Address


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway