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

  • Home
  • SEARCH
  • 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 6535639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:23:48+00:00 2026-05-25T10:23:48+00:00

I wrote a simple client-server application. It works very well on my computer. but

  • 0

I wrote a simple client-server application. It works very well on my computer. but when my friend tries to connect my server he can’t. I create the server on my computer with port 23. Here is the part of creating the server:

public Server(int port_number) throws IOException{

        create_Server(port_number);
    }

    public static void main(String[] args) throws IOException {

        int port_number=23;

        new Server(port_number);
    }

    private void create_Server(int port_number) throws IOException{

        ss = new ServerSocket(port_number);

        System.out.println("Server is ready!");

        while(true){

            s=ss.accept();

            System.out.println(s.getLocalAddress().getHostName() + " was connected!");

                        send_con_mes();

            list.put(s,new DataOutputStream(s.getOutputStream()) );

            new ServerThread(s,this).start();
        }

    }

and here is the client part ;

public void start_Chat() {

    try {

        Ip_addr = JOptionPane.showInputDialog("Enter the IP number of the server to connect : ");
        s = new Socket(Ip_addr, 23);

        Client_name = JOptionPane.showInputDialog("Enter your Nickname : ");

        dis = new DataInputStream(s.getInputStream());         
        dos = new DataOutputStream(s.getOutputStream());
        new Thread(Client.this).start();

well I can talk, send private messages etc. When I connect to server on my computer as clients, but the final problem is a client from another IP cannot get connected.

  • 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-25T10:23:49+00:00Added an answer on May 25, 2026 at 10:23 am

    You have to configure your network to allow this port to be accessed. This means enabling firewall on you PC, and your routers etc. There is nothing you can do in Java to avoid having to get this right first.

    EDIT: If the other machine is trying to connect to you via an Internet router they will have to use your public IP address rather than your internal PC address. If you don’t know your public address you can use a site like http://whatismyipaddress.com/. Unless you have a static IP address it can change when you reconnect. (One reason to stay connected all the time)

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

Sidebar

Related Questions

I try to write a simple client/server application (all application is a bluetooth service
I wrote an XML RPC server in python and a simple Test Client for
I wrote some sort of console client for a simple application. To be more
I'm going to write simple c++ application, server-client, client-client. I would like to develop
I wrote two simple programs server and a client using sockets in C++ (Linux).
I want to write a simple client-server application using corba and java. I'm using
I'm writing a simple client/server application and am having trouble getting the client to
I'm trying to create a simple chat application for iOS. It works for receiving
I'm trying to write a simple client/server chat application in 2 languages - Java
I am new to java NIO. I have to write a simple server client

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.