Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

A general question

Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I have developed a chat client and now I'd like to add file transfer capability to it. Here are some of the thoughts I've had with respect to I should go about implementing this.

1. Do I need additional sockets ONLY for the sake of transfering files?(i.e. reading/writing to an extra socket)

2. Do I need additional threads to handle this task? If so, should I construct a new socket or I'd be better off with the URL/URLConnection classes?

Thank you very much for you're help.
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMHO it would be better if youcould reuse the chat socket for file transfer.
If it's not possible open a new socket for file transfer and close it immediately. The proble with the second socket is that your application will consume another socket on the client side and limit the number of clients that can be serviced simultaneously.

If you decide to use a second socket most likely you'll want to spawn a second thread. If not does your network layer allow you to send the file and chat at the same time?

I answered another chat application topic today:
Get me the mayor's office! I need to tell him about this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic