Remote IP

SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Remote IP

Post by SylRob »

Good Morning Everyone,

IT's been a long time, isn't ! :)

Ok here is a my question, is it possible to know the Remote client IP adress when the connection goes through a ROUTER. I know that the complete ROUTE is in the TCP/IP packet. Can someone point me to the right direction,

Thank you,

Best Regards,
Sylvain Robert
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

If it can help someone !

I found how to do it with Teredo ! and will explore the possibility with SNMP protocol !

Ty,
Last edited by SylRob on Tue Feb 05, 2008 7:31 pm, edited 2 times in total.
Sylvain Robert
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Remote IP

Post by Enrico Maria Giordano »

Hi, Sylvain! Glad to see you here again! :-)

Unfortunately I can't help you with your problem. :-(

EMG
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Re: Remote IP

Post by SylRob »

Hi Enrico,


Nice to read you my friend ! :)

I already found a solution with IPV6 and Teredo protocol, I'll give a try to the SNMP protocol, it will be mor generic !

HTH,

Sylvain
Sylvain Robert
User avatar
Kleyber
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Post by Kleyber »

Hi Sylvain,

Glad to see you here again after a long time. You're always welcome!!

Best Regards,
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Kleyber,

Same pleasure for me kleyber ! :)

Hope things are going well for you !.

Best Regards,

Sylvain
Sylvain Robert
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Remote IP

Post by AlexSchaft »

Hi Sylvain,

Are you looking for the ip address of the client connecting to a server socket?

If so, you need oSocket:ClientIP()

Code: Select all

  nEchoPort                  := ::nPortNo+::nPortNo / 100

  Do While .t.
    ::oEchoSocket            := tsocket():New(nEchoPort)

    If ::oEchoSocket:lStartOK
      Exit
    Else
      nEchoPort++
    Endif
  Enddo

  ::oEchoSocket:bAccept      := {| oSocket | ::EchoAccept(oSocket:nSocket)}

  If !::oEchoSocket:Listen()
    ::Error("Monitor Listening socket error " + NTRIM(wsagetlasterror()))
  Endif

return nil

METHOD Echoaccept(pnSocket) CLASS qReceive

  Local oSocket              := nil

  oSocket                    := tsocket():Accept(pnSocket)

  oSocket:bRead              := {| poSocket |::EchoRead(poSocket)}
  oSocket:bWrite             := {| poSocket |::EchoWrite(poSocket)}
  oSocket:bClose             := {| poSocket |::EchoClose(poSocket)}

  ::Error("Listener joined from "+oSocket:Clientip(), False)

  aadd(::aaEchoSocket, {oSocket, 0, ,""})   // For flags and data

  oSocket:SendData("Welcome listener from "+oSocket:Clientip()+CRLF)
Return nil
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Alex,
Can I create on a fwh program a listbox where i can insert all Pc link to my server ?
I explain you
i have on a classroom a pc and another 24 pc link to this pc

I want see how many pc is open or not

In Vb this is possibile .. but in fwh I not Know How make it

thanks
Best Regards, Saludos

Falconi Silvio
User avatar
AlexSchaft
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Connecting

Post by AlexSchaft »

Yes,

The main pc runs the listen socket, and all the others connect to it on startup.

Increment a counter when they connect, and decrement when they disconnect
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Alex,

I'm really familiar with the socket function ! :). This won't work if the client connection come from the internet over a Router you'll obtain the ROUTER IP !

Best Regards,

Sylvain
Sylvain Robert
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Sylvain,

Glad to see you again :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Hey Antonio,

Thank's for the kind words, it was nice to read you again Antonio !

Best Regards,

Sylvain
Sylvain Robert
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Remote IP

Post by Patrick Mast »

SylRob wrote:Good Morning Everyone,

IT's been a long time, isn't ! :)

Ok here is a my question, is it possible to know the Remote client IP adress when the connection goes through a ROUTER. I know that the complete ROUTE is in the TCP/IP packet. Can someone point me to the right direction,

Thank you,

Best Regards,
Hey Mate! ;-)
Glad to see you here!

I use my Bekz.net server to receive the user's IP address. I have a small web site that just printts the user's IP address. Works all the time :)

Patrick
User avatar
Patrick Mast
Posts: 244
Joined: Sat Mar 03, 2007 8:42 pm

Re: Remote IP

Post by Patrick Mast »

Patrick Mast wrote:
SylRob wrote:Good Morning Everyone,

IT's been a long time, isn't ! :)

Ok here is a my question, is it possible to know the Remote client IP adress when the connection goes through a ROUTER. I know that the complete ROUTE is in the TCP/IP packet. Can someone point me to the right direction,

Thank you,

Best Regards,
Hey Mate! ;-)
Glad to see you here!

I use my Bekz.net server to receive the user's IP address. I have a small web site that just printts the user's IP address. Works all the time :)

Patrick
You can also use http://whatismyipaddress.com/ or similar.
Just read the HTML in a variable en take out the IP address.

Patrick
SylRob
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Post by SylRob »

Hello Patrick,

This won't work either, I'm not using HTTP protocol so I can't read session variable and second it's not my ROUTER IP that I need and I can't run code on the client side because any other software can connect to my TCP server (with the right protocol)

I wrote a TCP server that receive a client connection from Internet and the connection go through the ROUTER to reach my TCP server, so that's why I received the ROUTER IP in ALL languages that I tested ! :)

The only way to get the REAL client IP address is to use IPv6 TEREDO protocol or implement the STUN protocol (server outside the ROUTER who relay the connection to the REAL server), other thing I'll expirement at the moment I have time is to get the ROUTER table with SMNP and write a trace route routine to the final HOP to get the real IP address even if the client his behind a router at the other side !

Best Regards,

It was a real pleasure tu read you Patrick !

Sylvain
Sylvain Robert
Post Reply