FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Remote IP
Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Tue Feb 05, 2008 11:21 AM

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
Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Tue Feb 05, 2008 04:27 PM

If it can help someone !

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

Ty,

Sylvain Robert
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Remote IP
Posted: Tue Feb 05, 2008 06:37 PM

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

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

EMG

Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Re: Remote IP
Posted: Tue Feb 05, 2008 06:55 PM

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
Posts: 581
Joined: Tue Oct 11, 2005 11:28 AM
Remote IP
Posted: Tue Feb 05, 2008 07:27 PM

Hi Sylvain,

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

Best Regards,

Kleyber Derick



FWH / xHb / xDevStudio / SQLLIB
Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Tue Feb 05, 2008 07:31 PM

Kleyber,

Same pleasure for me kleyber ! :)

Hope things are going well for you !.

Best Regards,

Sylvain

Sylvain Robert
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Remote IP
Posted: Wed Feb 06, 2008 04:06 AM
Hi Sylvain,

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

If so, you need oSocket:ClientIP()

  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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Remote IP
Posted: Wed Feb 06, 2008 08:58 AM

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
Posts: 172
Joined: Fri Oct 07, 2005 01:29 PM
Connecting
Posted: Wed Feb 06, 2008 10:29 AM

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

Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Wed Feb 06, 2008 10:52 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Remote IP
Posted: Wed Feb 06, 2008 02:47 PM

Sylvain,

Glad to see you again :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Wed Feb 06, 2008 03:00 PM

Hey Antonio,

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

Best Regards,

Sylvain

Sylvain Robert
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Re: Remote IP
Posted: Wed Feb 06, 2008 03:39 PM
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
Posts: 246
Joined: Sat Mar 03, 2007 08:42 PM
Re: Remote IP
Posted: Wed Feb 06, 2008 03:41 PM
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
Posts: 15
Joined: Thu Nov 01, 2007 04:54 PM
Remote IP
Posted: Wed Feb 06, 2008 04:02 PM

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