Remote IP

Remote IP

Postby SylRob » 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
SylRob
 
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Postby SylRob » Tue Feb 05, 2008 4:27 pm

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
SylRob
 
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Re: Remote IP

Postby Enrico Maria Giordano » Tue Feb 05, 2008 6:37 pm

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

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Remote IP

Postby SylRob » Tue Feb 05, 2008 6: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
SylRob
 
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Postby Kleyber » Tue Feb 05, 2008 7: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
User avatar
Kleyber
 
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Postby SylRob » Tue Feb 05, 2008 7:31 pm

Kleyber,

Same pleasure for me kleyber ! :)

Hope things are going well for you !.

Best Regards,

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

Remote IP

Postby AlexSchaft » Wed Feb 06, 2008 4: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()

Code: Select all  Expand view  RUN
  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
AlexSchaft
 
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Postby Silvio » Wed Feb 06, 2008 8: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
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Connecting

Postby AlexSchaft » 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
User avatar
AlexSchaft
 
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Postby SylRob » 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
SylRob
 
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Postby Antonio Linares » Wed Feb 06, 2008 2:47 pm

Sylvain,

Glad to see you again :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby SylRob » Wed Feb 06, 2008 3:00 pm

Hey Antonio,

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

Best Regards,

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

Re: Remote IP

Postby Patrick Mast » Wed Feb 06, 2008 3: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Re: Remote IP

Postby Patrick Mast » Wed Feb 06, 2008 3: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
User avatar
Patrick Mast
 
Posts: 246
Joined: Sat Mar 03, 2007 8:42 pm

Postby SylRob » Wed Feb 06, 2008 4: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
SylRob
 
Posts: 15
Joined: Thu Nov 01, 2007 4:54 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests