Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: HELP with reading a clients ip address and storing in a text file.

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HELP with reading a clients ip address and storing in a text file.

    I understand how to do this with the loaclhost but confused on how to do this with determine the clients ip, any help would be great.

    Thanks


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: HELP with reading a clients ip address and storing in a text file.

    getRemoteAddr() of HTTPSERVLET.
    This will give you the IP of the client but one thing, if client is using proxy, it may not give you the exact IP but the proxy that is being used by client.

    If you want to get the exact IP of client, you'll have to use the header, this header is custom header for request and you should use it like,
    HTTPREQUEST req;
    req.getHeader("X-FORWARDED-FOR");
    I hope this will solve your problem.
    Last edited by Mr.777; April 4th, 2011 at 08:26 AM.

Similar Threads

  1. [SOLVED] Storing info into a text file & adding to it
    By BlackFlame in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 12th, 2011, 09:06 PM
  2. reading string in from text file
    By basketball8533 in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: December 3rd, 2010, 05:31 PM
  3. Reading a lines from text file
    By kiran in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: September 26th, 2010, 11:54 PM
  4. [SOLVED] Reading from a text file and storing in arrayList
    By nynamyna in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 26th, 2010, 10:55 PM
  5. Reading from a text file. Help needed urgently.
    By TheAirPump in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: December 14th, 2009, 06:16 PM