Hello,
I need a long number to IP Address Convertion Function.
Take
3349551105
to
199.166.24.1
Please let me know if anyone has such a function.
Thanks in advance for your help,
Jack 10 1745
On 2005-05-31, Jack <jo***@webfoxmail.com> wrote: Hello,
I need a long number to IP Address Convertion Function.
Take
3349551105
to
199.166.24.1
Please let me know if anyone has such a function.
Thanks in advance for your help,
Jack
Dim IP As String = New IPAddress (myLongValue).ToString ()
--
Tom Shelton [MVP]
r u using irc chat?
Jack wrote: Hello,
I need a long number to IP Address Convertion Function.
Take
3349551105
to
199.166.24.1
Please let me know if anyone has such a function.
Thanks in advance for your help,
Jack
Hello Tom,
Thanks, it works great. There is one problem it is printing the IP address
backwords.
199.166.24.1
Comes out
1.24.166.199
Please let me know if how to fix this.
Thank you for all of your help,
Jack
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl... On 2005-05-31, Jack <jo***@webfoxmail.com> wrote: Hello,
I need a long number to IP Address Convertion Function.
Take
3349551105
to
199.166.24.1
Please let me know if anyone has such a function.
Thanks in advance for your help,
Jack
Dim IP As String = New IPAddress (myLongValue).ToString () -- Tom Shelton [MVP]
On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: Hello Tom,
Thanks, it works great. There is one problem it is printing the IP address backwords.
199.166.24.1
Comes out
1.24.166.199
Please let me know if how to fix this.
Thank you for all of your help,
Jack
Ooops... Try this:
Dim IP As String = New IPAddress _
(IPAddress.NetworkToHostOrder (MyLongValue)).ToString()
--
Tom Shelton [MVP]
Hello Tom,
Thanks for the fast response. I am getting this error using the new
command:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred
in system.dll
Please let me know what I am doing wrong.
Thanks for your help and time,
Jack
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message
news:Ob*************@TK2MSFTNGP12.phx.gbl... On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: Hello Tom,
Thanks, it works great. There is one problem it is printing the IP address backwords.
199.166.24.1
Comes out
1.24.166.199
Please let me know if how to fix this.
Thank you for all of your help,
Jack
Ooops... Try this:
Dim IP As String = New IPAddress _ (IPAddress.NetworkToHostOrder (MyLongValue)).ToString()
-- Tom Shelton [MVP]
On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: Hello Tom,
Thanks for the fast response. I am getting this error using the new command:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.dll
Please let me know what I am doing wrong.
Thanks for your help and time,
Jack
Hmm... Jack - let me play with this some more (if no one else jumps in).
This is what I get for not testing my responses :)
--
Tom Shelton [MVP]
In article <OM**************@tk2msftngp13.phx.gbl>, Jack wrote: Hello Tom,
Thanks for the fast response. I am getting this error using the new command:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.dll
Please let me know what I am doing wrong.
Thanks for your help and time,
Jack
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message news:Ob*************@TK2MSFTNGP12.phx.gbl... On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: Hello Tom,
Thanks, it works great. There is one problem it is printing the IP address backwords.
199.166.24.1
Comes out
1.24.166.199
Please let me know if how to fix this.
Thank you for all of your help,
Jack
Ooops... Try this:
Dim IP As String = New IPAddress _ (IPAddress.NetworkToHostOrder (MyLongValue)).ToString()
Ok... One more shot :)
Option Strict On
Option Explicit On
Imports System.Net
Module Module1
Sub Main()
Dim tmpIP As New IPAddress(3349551105)
Dim bytes() As Byte = tmpIP.GetAddressBytes()
Array.Reverse(bytes)
Dim addr As Long = BitConverter.ToInt32(bytes, 0)
Console.WriteLine(New IPAddress(addr).ToString())
Console.ReadLine()
End Sub
End Module
--
Tom Shelton [MVP]
Thank you very much!!!
Jack
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:ef**************@TK2MSFTNGP12.phx.gbl... In article <OM**************@tk2msftngp13.phx.gbl>, Jack wrote: Hello Tom,
Thanks for the fast response. I am getting this error using the new command:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.dll
Please let me know what I am doing wrong.
Thanks for your help and time,
Jack
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message news:Ob*************@TK2MSFTNGP12.phx.gbl... On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: Hello Tom,
Thanks, it works great. There is one problem it is printing the IP address backwords.
199.166.24.1
Comes out
1.24.166.199
Please let me know if how to fix this.
Thank you for all of your help,
Jack
Ooops... Try this:
Dim IP As String = New IPAddress _ (IPAddress.NetworkToHostOrder (MyLongValue)).ToString()
Ok... One more shot :)
Option Strict On Option Explicit On
Imports System.Net
Module Module1
Sub Main() Dim tmpIP As New IPAddress(3349551105) Dim bytes() As Byte = tmpIP.GetAddressBytes() Array.Reverse(bytes) Dim addr As Long = BitConverter.ToInt32(bytes, 0) Console.WriteLine(New IPAddress(addr).ToString()) Console.ReadLine() End Sub
End Module
-- Tom Shelton [MVP]
Hello,
I have made a function out off the info:
Function IPNumber2IPAddress(ByVal IP As Long) As String
Dim tmpIP As New System.Net.IPAddress(IP)
Dim bytes() As Byte = tmpIP.GetAddressBytes()
Array.Reverse(bytes)
Dim addr As Long = BitConverter.ToInt32(bytes, 0)
IPNumber2IPAddress = New System.Net.IPAddress(addr).ToString()
End Function
It work most of the time, but when the IP Number is : 1167456428
I get an 'ArgumentOutOfRangeException' Error.
Any help would be great!!
Thanks,
Jack
"Jack" <jo***@webfoxmail.com> wrote in message
news:eV****************@TK2MSFTNGP09.phx.gbl... Thank you very much!!!
Jack
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message news:ef**************@TK2MSFTNGP12.phx.gbl... In article <OM**************@tk2msftngp13.phx.gbl>, Jack wrote: Hello Tom,
Thanks for the fast response. I am getting this error using the new command:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.dll
Please let me know what I am doing wrong.
Thanks for your help and time,
Jack
"Tom Shelton" <ts******@YOUKNOWTHEDRILLcomcast.net> wrote in message news:Ob*************@TK2MSFTNGP12.phx.gbl... On 2005-06-01, Jack <jo***@webfoxmail.com> wrote: > Hello Tom, > > Thanks, it works great. There is one problem it is printing the IP > address > backwords. > > 199.166.24.1 > > Comes out > > 1.24.166.199 > > Please let me know if how to fix this. > > Thank you for all of your help, > > Jack
Ooops... Try this:
Dim IP As String = New IPAddress _ (IPAddress.NetworkToHostOrder (MyLongValue)).ToString()
Ok... One more shot :)
Option Strict On Option Explicit On
Imports System.Net
Module Module1
Sub Main() Dim tmpIP As New IPAddress(3349551105) Dim bytes() As Byte = tmpIP.GetAddressBytes() Array.Reverse(bytes) Dim addr As Long = BitConverter.ToInt32(bytes, 0) Console.WriteLine(New IPAddress(addr).ToString()) Console.ReadLine() End Sub
End Module
-- Tom Shelton [MVP]
Jack wrote: Hello,
I have made a function out off the info:
Function IPNumber2IPAddress(ByVal IP As Long) As String
Dim tmpIP As New System.Net.IPAddress(IP)
Dim bytes() As Byte = tmpIP.GetAddressBytes()
Array.Reverse(bytes)
Dim addr As Long = BitConverter.ToInt32(bytes, 0)
IPNumber2IPAddress = New System.Net.IPAddress(addr).ToString()
End Function
It work most of the time, but when the IP Number is : 1167456428
I get an 'ArgumentOutOfRangeException' Error.
Any help would be great!!
Change
Dim addr As Long = BitConverter.ToInt32(bytes, 0)
to
Dim addr As Long = Convert.ToInt64(BitConverter.ToUInt32(bytes, 0))
as with high IP Numbers you were getting negative Integers from
ToInt32.
--
Larry Lard
Replies to group please This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {...
|
by: phil_gg04 |
last post by:
Dear Javascript Experts,
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function...
|
by: laredotornado |
last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to
have my Javascript function execute from the BODY's "onload" method,
but if there is already an onload method defined, I would...
|
by: sushil |
last post by:
+1 #include<stdio.h>
+2 #include <stdlib.h>
+3 typedef struct
+4 {
+5 unsigned int PID;
+6 unsigned int CID;
+7 } T_ID;
+8
+9 typedef unsigned int (*T_HANDLER)(void);
+10
|
by: Olov Johansson |
last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7
and Konqueror 3.5) has support not only for standard function
definitions, function expressions (lambdas) and Function...
|
by: Beta What |
last post by:
Hello,
I have a question about casting a function pointer. Say I want to make
a generic module (say some ADT implementation) that requires a function
pointer from the 'actual/other modules'...
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: ...
|
by: Larax |
last post by:
Best explanation of my question will be an example, look below at this
simple function:
function SetEventHandler(element)
{
// some operations on element
element.onclick =
function(event)
{
|
by: alex |
last post by:
I am so confused with these three concept,who can explained it?thanks
so much?
e.g.
var f= new Function("x", "y", "return x * y");
function f(x,y){
return x*y
}
var f=function(x,y){
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |