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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:45:35+00:00 2026-06-12T14:45:35+00:00

I wrote a simple server client socket program and when I recompile the server

  • 0

I wrote a simple server client socket program and when I recompile the server I get:

java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)

Therefore my question is how to kill the socket under windows 7? Is there a possible solution to kill it in eclipse?

I appreciate your answer!!

  • 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-06-12T14:45:36+00:00Added an answer on June 12, 2026 at 2:45 pm

    Here is my code for server side:

    import java.io.*;
    import java.net.*;
    
    public class ServerSide {
    
    
        public static void main(String[] args) {
    
            try
            {
                ServerSocket myServerSocket = new ServerSocket(9999);
                System.out.println("Server is waiting on host" + InetAddress.getLocalHost().getCanonicalHostName() + "port= "+ myServerSocket.getLocalPort());
                Socket skt = myServerSocket.accept();
    
                BufferedReader myInput = new BufferedReader(new InputStreamReader(skt.getInputStream()));
                PrintStream myOutput = new PrintStream(skt.getOutputStream());
    
                String buf = myInput.readLine();
                System.out.println("Server readLine");
                if(buf!=null)
                {
                    System.out.println("Buf = " + buf);
                    myOutput.print("Got it?");
                }
                else
                {
                    System.out.println("Nothing returned in server sidex`x  ");
                }
                skt.close();
                System.out.println("Server shutdown");
            }
            catch(IOException e)
            {
                e.printStackTrace();
                System.out.println("Whooops");
            }
        }
    
    }
    

    As you can see for clean-up I’ve written:

            skt.close();
    

    But maybe this is not your problem, Maybe your problem is which I had 1 hour ago 😉 I used to run a program but the result is not what I expected so I modify it and run it again but the port was busy or already in use! What I do on eclipse? Under the Console where you get the error, on the right side of the window there is red colour rectangle button! It say “Terminate”. If you click on that your port will be free. By the way don’t forget to check the console for both(Server/Client) sides.

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

Sidebar

Related Questions

So I wrote a simple Socket program that send message from Client to Server
I wrote an XML RPC server in python and a simple Test Client for
I wrote two simple programs server and a client using sockets in C++ (Linux).
I wrote a simple server and client apps, where I can switch between TCP,
I have a simple programs for socket client and server its not working over
I am implementing both server and client side of a simple file download program.
I'm trying to write a simple server-client program, but I have a problem: I
i'm trying to write simple tcp\ip client-server. here is server code: internal class Program
I wrote a simple program where a server should print data sent by multiple
I've been using this tutorial for a simple file transfer client/server using socket IO.

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.