LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2008, 01:11 AM   #1
ini_hendry
LQ Newbie
 
Registered: Aug 2007
Posts: 17

Rep: Reputation: 0
correct way to get client ip address ?


i'm writing socket program..

suppose i create a webserver..
i want to record all clients ip ..

what is the correct way to do this ?



For now, i solve this problem with directly parsing the header of every request that come from client. (i got the client ip from the "Referer: http://xxx.xx.xx.x/bla.html" line. This doesn't seem correct to me..(is it correct ??)

Anyway.., any suggestion ?
 
Old 01-07-2008, 05:20 AM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
It would have helped if you said in what language you are programming. When it is C, you can retrive the address from the accept() function. In other languages there should be a similar construct.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gettting the correct Client address in Tomcat Servlet when sitting behind Pound umach Linux - Networking 1 01-07-2008 03:05 AM
Tomcat HttpServlet cannot see correct remote address umach Linux - Newbie 0 01-06-2008 11:39 PM
Fedora Core 6 questions: correct image + NetBackup client BethR Fedora 20 04-24-2007 11:56 AM
do not recieve correct ip address from dhcp server BCarey Linux - Wireless Networking 2 06-09-2006 02:27 PM
ni52 can't find memory, but address correct Wim_Woittiez Linux - Hardware 0 12-01-2003 01:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration