• Post Reply Bookmark Topic Watch Topic
  • New Topic

Send, receive, and play music files through network.

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
After an annoying few hours, I've finally got it.
Server (FileHostingServer.java) :

Client (FileHostingClient.java) :
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!