| 
	
		|  Autor | Tema: Obtener mediante codigo la ip publica de mi PC  (Leído 6,730 veces) |  
	| 
			| 
					
						| 5v5 
								
								 Desconectado 
								Mensajes: 57
								
								
								
								
								
								   | 
 
Hola..buen dia...Miren tengo un problema...
 
 ¿Como puedo saber la ip con la que salgo a internet ?....
 he encontrado informacion pero esta depende de una url..que me devuelve mi ip publica... Pero la verdad yo necesito hacer un programa que me diga cual es mi ip publica si depender de la una url...bueno espero me puedan ayudar...pero de antemano gracias por su atencion....
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| NYlOn 
								 
								
								 Desconectado 
								Mensajes: 842
								
								 
								OOOOHHHHHH, TARAGÜIIII       xDDDDDD
								
								
								
								
								
								     | 
 
En 1 formControles:
 -TextBox: Text1
 -Winsock Control: Winsock1
 
 Form_Load()
 Text1.Text = Winsock1.LocalIP
 End Sub
 
 
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Manibal_man 
								 
								
								 Desconectado 
								Mensajes: 528
								
								   | 
 
Sabes que es un public IP?, porque con la propiedad LocalIP creo que es logico que IP te devuelve...
 Saludos
 |  
						| 
								|  |  
								|  |  En línea | 
 
 :: I was born ready motha fucka :: |  |  |  | 
			| 
					
						| _Sergi_ 
								 
								
								 Desconectado 
								Mensajes: 842
								
								   | 
 
Yo creo que la Local Ip que devuelve el WinSock es la IP local de la máquina (como su nombre indica)
 Eso de la public ip...
 |  
						| 
								|  |  
								|  |  En línea | 
 
 Proyecto de Ingeniero |  |  |  | 
			| 
					
						| sorcerer 
								 
								
								 Desconectado 
								Mensajes: 365
								
								   | 
 
eso te da el ip de la lan, si tenes tu compu en red o si tenes adsl no te sirve |  
						| 
								|  |  
								|  |  En línea | 
 
 Las creaciones humanas son imperfectas,por la imperfeccion de su creador
 |  |  |  | 
			| 
					
						| EstoyBaneado 
								
								 Desconectado 
								Mensajes: 165
								
								 
								Él es DIOS.
								
								
								
								
								
								     | 
 
es todo este rollo de codigo: Private Const WS_VERSION_REQD = &H101Private Const WS_VERSION_MAJOR = WS_VERSION_REQD \ &H100 And &HFF&
 Private Const WS_VERSION_MINOR = WS_VERSION_REQD And &HFF&
 Private Const MIN_SOCKETS_REQD = 1
 Private Const SOCKET_ERROR = -1
 Private Const WSADescription_Len = 256
 Private Const WSASYS_Status_Len = 128
 
 Private Type HOSTENT
 hName As Long
 hAliases As Long
 hAddrType As Integer
 hLength As Integer
 hAddrList As Long
 End Type
 
 Private Type WSADATA
 wversion As Integer
 wHighVersion As Integer
 szDescription(0 To WSADescription_Len) As Byte
 szSystemStatus(0 To WSASYS_Status_Len) As Byte
 iMaxSockets As Integer
 iMaxUdpDg As Integer
 lpszVendorInfo As Long
 End Type
 
 Private Declare Function WSAGetLastError Lib "WSOCK32.DLL" () As Long
 Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal _
 wVersionRequired As Integer, lpWSAData As WSADATA) As Long
 Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
 
 Private Declare Function gethostname Lib "WSOCK32.DLL" (ByVal hostname$, ByVal HostLen As Long) As Long
 Private Declare Function gethostbyname Lib "WSOCK32.DLL" (ByVal _
 hostname$) As Long
 Private Declare Sub RtlMoveMemory Lib "kernel32" (hpvDest As Any, ByVal hpvSource&, ByVal cbCopy&)
 Const MAX_IP = 5   'To make a buffer... i dont think you have more than 5 ip on your pc..
 Private Type IPINFO
 dwAddr As Long   ' IP address
 dwIndex As Long ' interface index
 dwMask As Long ' subnet mask
 dwBCastAddr As Long ' broadcast address
 dwReasmSize  As Long ' assembly size
 unused1 As Integer ' not currently used
 unused2 As Integer '; not currently used
 End Type
 Private Type MIB_IPADDRTABLE
 dEntrys As Long   'number of entries in the table
 mIPInfo(MAX_IP) As IPINFO  'array of IP address entries
 End Type
 Private Type IP_Array
 mBuffer As MIB_IPADDRTABLE
 BufferLen As Long
 End Type
 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
 Private Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long
 'converts a Long to a string
 Public Function ConvertAddressToString(longAddr As Long) As String
 Dim myByte(3) As Byte
 Dim Cnt As Long
 CopyMemory myByte(0), longAddr, 4
 For Cnt = 0 To 3
 ConvertAddressToString = ConvertAddressToString + CStr(myByte(Cnt)) + "."
 Next Cnt
 ConvertAddressToString = Left$(ConvertAddressToString, Len(ConvertAddressToString) - 1)
 End Function
 
 Public Function GetWanIP() As String
 Dim Ret As Long, Tel As Long
 Dim bBytes() As Byte
 Dim TempList() As String
 Dim TempIP As String
 Dim Tempi As Long
 Dim Listing As MIB_IPADDRTABLE
 Dim L3 As String
 
 
 On Error GoTo END1
 GetIpAddrTable ByVal 0&, Ret, True
 
 
 If Ret <= 0 Then Exit Function
 ReDim bBytes(0 To Ret - 1) As Byte
 ReDim TempList(0 To Ret - 1) As String
 
 'retrieve the data
 GetIpAddrTable bBytes(0), Ret, False
 
 'Get the first 4 bytes to get the entry's.. ip installed
 CopyMemory Listing.dEntrys, bBytes(0), 4
 
 For Tel = 0 To Listing.dEntrys - 1
 'Copy whole structure to Listing..
 CopyMemory Listing.mIPInfo(Tel), bBytes(4 + (Tel * Len(Listing.mIPInfo(0)))), Len(Listing.mIPInfo(Tel))
 TempList(Tel) = ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr)
 Next Tel
 'Sort Out The IP For WAN
 TempIP = TempList(0)
 For Tempi = 0 To Listing.dEntrys - 1
 L3 = Left(TempList(Tempi), 3)
 If L3 <> "169" And L3 <> "127" And L3 <> "192" Then
 TempIP = TempList(Tempi)
 End If
 Next Tempi
 GetWanIP = TempIP 'Return The TempIP
 
 
 Exit Function
 END1:
 GetWanIP = ""
 End Function
 
luego, llamas a la funcion con GetWanIP() pruebalo, y si te gusta me lo pagas, que ando necesitando dinero para el concierto de Rammstein en argentina!!!! aunque sea unos dolares tirame        Salu2 |  
						| 
								|  |  
								|  |  En línea | 
 
 Fui baneado por decir lo que pienso... No importa, rezare por uds... y eso que soy ateo xD
 |  |  |  | 
			| 
					
						| Manibal_man 
								 
								
								 Desconectado 
								Mensajes: 528
								
								   | 
 
[NML] No quiero acusar sin motivos, pero realmente me parece muy mal lo que haces... postear un code sin citar fuentes es robar... pero puede pasar como un error...  El tema es cuando no solo posteas un code de otros sin citar fuentes sino que BORRAS SU FIRMA.. aca es donde se hace explicito el robo... PoC 'in a module:'******************************************************************
 'Origin Created By Verburgh Peter.
 'Modified By TapTapYu (taptapyu@yahoo.com)
 'The origin example to get the list of IP already very good, i modified it, so
 'if user is connected to internet, it will not return the Lan IP
 '******************************************************************
 
 Const MAX_IP = 5   'To make a buffer... i dont think you have more than 5 ip on your pc..
 Type IPINFO
 dwAddr As Long   ' IP address
 dwIndex As Long ' interface index
 dwMask As Long ' subnet mask
 dwBCastAddr As Long ' broadcast address
 dwReasmSize  As Long ' assembly size
 unused1 As Integer ' not currently used
 unused2 As Integer '; not currently used
 End Type
 Type MIB_IPADDRTABLE
 dEntrys As Long   'number of entries in the table
 mIPInfo(MAX_IP) As IPINFO  'array of IP address entries
 End Type
 Type IP_Array
 mBuffer As MIB_IPADDRTABLE
 BufferLen As Long
 End Type
 Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
 Public Declare Function GetIpAddrTable Lib "IPHlpApi" (pIPAdrTable As Byte, pdwSize As Long, ByVal Sort As Long) As Long
 'converts a Long to a string
 Public Function ConvertAddressToString(longAddr As Long) As String
 Dim myByte(3) As Byte
 Dim Cnt As Long
 CopyMemory myByte(0), longAddr, 4
 For Cnt = 0 To 3
 ConvertAddressToString = ConvertAddressToString + CStr(myByte(Cnt)) + "."
 Next Cnt
 ConvertAddressToString = Left$(ConvertAddressToString, Len(ConvertAddressToString) - 1)
 End Function
 Public Function GetWanIP() As String
 Dim Ret As Long, Tel As Long
 Dim bBytes() As Byte
 Dim TempList() As String
 Dim TempIP As String
 Dim Tempi As Long
 Dim Listing As MIB_IPADDRTABLE
 Dim L3 As String
 
 
 On Error GoTo END1
 GetIpAddrTable ByVal 0&, Ret, True
 
 
 If Ret <= 0 Then Exit Function
 ReDim bBytes(0 To Ret - 1) As Byte
 ReDim TempList(0 To Ret - 1) As String
 
 'retrieve the data
 GetIpAddrTable bBytes(0), Ret, False
 
 'Get the first 4 bytes to get the entry's.. ip installed
 CopyMemory Listing.dEntrys, bBytes(0), 4
 
 For Tel = 0 To Listing.dEntrys - 1
 'Copy whole structure to Listing..
 CopyMemory Listing.mIPInfo(Tel), bBytes(4 + (Tel * Len(Listing.mIPInfo(0)))), Len(Listing.mIPInfo(Tel))
 TempList(Tel) = ConvertAddressToString(Listing.mIPInfo(Tel).dwAddr)
 Next Tel
 'Sort Out The IP For WAN
 TempIP = TempList(0)
 For Tempi = 0 To Listing.dEntrys - 1
 L3 = Left(TempList(Tempi), 3)
 If L3 <> "169" And L3 <> "127" And L3 <> "192" Then
 TempIP = TempList(Tempi)
 End If
 Next Tempi
 GetWanIP = TempIP 'Return The TempIP
 
 
 Exit Function
 END1:
 GetWanIP = ""
 End Function
 
Nada... me indignan este tipo de cosas xq mas de una vez me las hicieron a mi y se que se siente...http://www.developerfusion.co.uk/forums/topic-28570http://www.mvp-access.com/buho/ficheros/ipinternet.txthttp://www.vbwm.com/forums/topic.asp?TOPIC_ID=3975 Y estas en el "laboratorio"...  :'( /EDIT: pruebalo, y si te gusta me lo pagas, que ando necesitando dinero para el concierto de Rammstein en argentina!!!! aunque sea unos dolares tirame  Wink Wink Wink
 Salu2
 Encima agregas esto?!?!?!, haciendo mas explicito tu robo?... esta es una patetica demostracion de las bajezas que definen a un LAMMER. Saludos |  
						| 
								|  |  
								| « Última modificación: 24 Agosto 2005, 03:47 am por Manibal_man » |  En línea | 
 
 :: I was born ready motha fucka :: |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | [SOLUCIONADO]Obtener mi propia IP pública en JAVA. Java
 | 23time | 7 | 25,361 |  13 Abril 2010, 01:43 am por 23time
 |  
						|   |   | Obtener Ip Pública Dudas Generales
 | itzg3 | 5 | 8,274 |  8 Diciembre 2010, 22:47 pm por sclub
 |  
						|   |   | Obtener IP PUBLICA .NET (C#, VB.NET, ASP)
 | BrokerJoker | 5 | 12,153 |  3 Febrero 2012, 21:29 pm por dont'Exist
 |  
						|   |   | ¿como obtener ip publica con c++? Programación C/C++
 | Kaxperday | 3 | 2,877 |  13 Septiembre 2015, 23:25 pm por Kaxperday
 |  
						|   |   | [Pregunta]: ¿Este código es eficiente para obtener la IP Pública? Desarrollo Web
 | Leguim | 4 | 4,115 |  19 Agosto 2020, 08:26 am por #!drvy
 |    |