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 7610097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:20:11+00:00 2026-05-31T01:20:11+00:00

I am working on a j2me application that sends data to PC over WiFi

  • 0

I am working on a j2me application that sends data to PC over WiFi using Sockets. What should be the server address? i.e. What should I use instead of ‘localhost’ in the code below?

Client Code(j2me):

SocketConnection sc = (SocketConnection)
Connector.open("socket://localhost:9002");
DataOutputStream os = null;
try{
    os = sc.openDataOutputStream();
    os.writeUTF("Test Dama");
} finally{
  sc.close();
  os.close();
}

Server Code(j2se):

    ServerSocket echoServer = null;
    String line;
    DataInputStream is;

    Socket clientSocket = null;

    try {
       echoServer = new ServerSocket(9002);
    }
    catch (IOException e) {
       System.out.println(e);
    }
    try {
       clientSocket = echoServer.accept();
       is = new DataInputStream(clientSocket.getInputStream());

       line = is.readUTF();

       System.out.println("Received:"+line);

    }
    catch (IOException e) {
       System.out.println(e);
    }
  • 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-31T01:20:13+00:00Added an answer on May 31, 2026 at 1:20 am

    That depends on the ip/domain of the server.

    If you are running things on a local network (in your home/office) then just find out what is the ip of the machine running the server code.
    In linux systems you can find that with the command ifconfig, then in the output the ip address is under inet addr. In windows systems use ipconfig /all.

    Once you have the ip of the machine running the server, just put that instead of the localhost that you are using in the client.

    If you want this to work on the public network though, you’ll have to run the server code on a machine that has a static ip (or use dynamic DNS).

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

Sidebar

Related Questions

I'm working on a J2ME application using LWUIT. I need to show 10 values
I am working on an application, using java, that has the following features: User
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB.
I'm developing a j2me application using Netbeans IDE and LWUIT library. I need to
We are developing a J2ME application and sometimes we face constraints while working with
i am working with Eclipse to develop a application in J2ME.In This application i
I'm working on a J2ME applicatoin using LWUIT and would like to support most
I made the simple j2me login application, code is below. It's working perfectly on
We are start working with J2ME application where we need the XML parsers based
I am working on a j2me application and I need to wait for a

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.