PDA

View Full Version : How to get ur ip


Jordan_Samp_Son
11-01-2003, 11:01 PM
Hi i wanted to know how i can get my ip into a textbox on form load with winsock

Illusionist
11-01-2003, 11:03 PM
text1.text = winsock1.localIP

Jordan_Samp_Son
11-01-2003, 11:05 PM
Thanks

Jamescun
11-02-2003, 11:51 AM
What about getting the Ip of a remote computer?

coco_3010
11-04-2003, 04:29 AM
Well, all you do is basicly the same but you put some other in

text1.text = winsock1.remoteip

or you could use a better method of obtaining the ip address without using winsock, if you want this message notify me in this thread!

deathman5
11-07-2003, 05:37 AM
Well, all you do is basicly the same but you put some other in

text1.text = winsock1.remoteip

this isnt working, there's nothing called
winsock1.remoteip

Illusionist
11-07-2003, 06:01 AM
RemoteHostIP

deathman5
11-07-2003, 06:12 AM
you know I tried that too, I would not posted that post if it work!

Private Sub Command1_Click()
Text1.Text = Winsock1.RemoteHostIP
End Sub

does not work, text1 changes to nothing (empty)
does it work on your PC?

Illusionist
11-07-2003, 10:59 AM
Because its not meant to be used that way. When a client connects to a host it uses that:

Winsock1.RemoteHostIP = xxx.xxx.xxx.xxx
Winsock1.RemoteHostPort = xxxx


When I replied with RemoteHostIP, I didn't read to see what you were trying to do. I just saw remoteip, and it should've been RemoteHostIP.
Sorry.

PS: There are other ways to find out someone elses IP address.

bazza_y
11-15-2003, 07:23 PM
You have to be connected to another computer to have a RemoteHostIP

eg:



Winsock1.Connect "192.155.5.2", 1234
Text1.Text = Winsock1.RemoteHostIP




Or if you're on a server side then



Private Sub Form_Load()
Winsock1.Listen
End Sub

Private Sub Winsock1_ConnectionRequest(requestID as Long)
Winsock1.Accept requestID

connect to the computer trying to connect to ours.

Text1.Text = Winsock1.RemoteHostIP
End Sub



That should work. I don't have much experience, though.

Bazza