• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Send, receive, and play music files through network.

 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a client. It receives values (a string) when it connects to a server. The server returns string names of music files that are available. The client then has choices in the JList. If he or she double clicks on one of the names, the client makes a request to the server for music file information. The server then sends the music file information to the client, who then plays it.

This scenario above describes what I want to happen. So far, I've gotten through to the last part. I have it sending and receiving as a string. I need insight on how to send and receive the file. I also need to know how to play it. What I think I have to do is send the music as bytes, receive it as bytes, then convert the bytes to an InputStream. Then, I can play the InputStream. If you could help me do this, that would be awesome. I am receiving the "message" as a String value, so I'm not sure how to receive as bytes and still be able to read as string values (IE : For the "stop" and "FileUpload" commands).

Thanks,
John Price

EDIT: Server and Client code revised below, along with picture and new description of problem.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After an annoying few hours, I've finally got it.
Server (FileHostingServer.java) :

Client (FileHostingClient.java) :
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic