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

The Archive Base Latest Questions

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

I wrote a Server and a Client with GUI to transfer text between them

  • 0

I wrote a Server and a Client with GUI to transfer text between them and they work well. I searched Google “how to send files through a network” then I found this beautiful solution (see Andrey Kozhanov reply) . I moved the server class in the link to my server package and the client class in the link to my client package to try and they work well. Now I can send instant text messages, and instant files.

I wrote every thing necessary to make communication work smoothly to meet users expectations.

The problem is The problem occur at a specific scenario.

The two servers have different port numbers; (mine for text and the one in the link for files)
Stage 1
1- the client request the server to send a file.
2- the server reply with (Yes) (dialogue yes-no-options).
3- the client navigate the File Chooser’s List.
4- the client cancel the File Chooser (didn’t send a file).
5- the server informed about the client cancellation.
Stage 2
– again
1- the client request the server to send a file.
2- the server reply with (Yes). error occur at the server side;

the first line of the error is:

java.net.BindException: Address already in use: JVM_Bind

I begin the receiving thread at the Server package like this

        recieverThread = new Recieving();
        recieverThread.setDaemon(true);
        recieverThread.start();

The problem traced back to stage 1 number 5 (5- the server informed about the client cancellation.). since the server thread for receiving files from client start, then at point 5 I must stop it. to stop this thread I use combination of

        recieverThread.interrupt();
        recieverThread = null;

But when it started again at stage 2, it seems that it still running and is not stopped. I want to kill it so that when I want to start a new thread no error occur.

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

    That is not a threading problem, but a server socket problem. Reusing a Socket immediately is disallowed by TCP/IP because the reuser could see packets targeted at the old user.

    See this question on how to reuse sockets.

    • 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
so I wrote this Server/Client applications that communicate with each other over send() and
I wrote c# client-server application, server is sending data using socket.send(byte[]) and receive using
I wrote a server-client communication program and it worked well. Client module import java.io.*;
I wrote a simple client/server in java that transfers files using java NIO Socketchannel.
I wrote a server-client rmi application and I'm using MacOsX and Ubuntu laptops to
I wrote a makefile: all: server client server: server.o des.o sha1.o /usr/local/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o server
I wrote two small applications (a client and a server) to test UDP communication
I wrote an XML RPC server in python and a simple Test Client for
I wrote a game in Java with a client and server side using sockets

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.