Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6916603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:37:28+00:00 2026-05-27T09:37:28+00:00

In my app, I create a ServerSocket , and wait for connections: while(isRunning) {

  • 0

In my app, I create a ServerSocket, and wait for connections:

while(isRunning) {
    try {
        socket = serverSocket.accept();

I then try to get the remote IP of the resulting socket:

socket.getInetAddress().getHostAddress();

However, this seems to only return an IPv6 address.

For my purposes, I believe I need an IPv4. Is there some way to get an IPv4 address from a socket?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:37:28+00:00Added an answer on May 27, 2026 at 9:37 am

    If the client has connected to an IPv6 address (i.e., if your server is IPv6 hosted), then you’ll only have the IPv6 address. You’ll need to host you server in IPv4 space as well (or instead of), then have the client connect to the IPv4 address in order to get the IPv4 address of the client.

    You may be able to do a lookup via DNS, but this won’t be reliable (i.e., do reverse lookup of IPv6 address to get hostname, then do a forward lookup, looking for A records on the host). This assumes that reverse DNS has been set up though for the address, which isn’t guaranteed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create 2 buttons inside my app case WM_CREATE:{ hWnd =CreateWindowEx(NULL, LBUTTON,
I started a grails application by grails create-app. For modularity, I feel like it
I have an app where I create many uiviews and add them to the
I would like to create an app for a pocket pc. One of the
I'm trying to create an app for Android that simply sends a command to
I'm looking to create an app based on the OSGi model. One of the
I would like to create small app (in C#) to switch active keyboards and
I'm setting out to create an app where it will use 7-10 instances of
Iam planning to create an app, and not to publish it at the google
I used In App Purchase and i follow all step to create In App

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.