|
-
Nov 9th, 2000, 02:33 PM
#1
Thread Starter
Member
Hi,
I am trying to write a server program and I was wondering
if anyone knows how I can find out what the IP address of
the client logging on to the server is?
I am using winsock API calls! Not the winsock control.
Thanks!
-
Nov 13th, 2000, 03:34 AM
#2
Try this:
request.servervariables("remote_addr")
Good Luck!
-
Nov 13th, 2000, 04:26 AM
#3
Conquistador
ummm... doesn't that only work in asp?
-
Nov 13th, 2000, 04:26 PM
#4
Thread Starter
Member
Thanks for your reply, it seems that this function
was the one I was looking for:
ToDo = getpeername(Csock, sADDR, Len(sADDR))
ToDo = sADDR.sin_addr
mRemoteIP = lngIPtoStrIP(ToDo)
Public Function lngIPtoStrIP(ByVal longip As Long) As String
Dim dotted As String
Dim i As Long
Dim tval As Long
If longip < 0 Then
tval = 255
longip = longip + 1
End If
For i = 1 To 3
dotted = dotted + CStr((longip Mod 256) + tval) + "."
longip = Fix(longip \ 256)
Next
dotted = dotted + CStr(longip + tval)
lngIPtoStrIP = dotted
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|