Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Uploading MP3 to server
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chrisbrown




PostPosted: Thu Oct 16, 2008 2:30 pm   Post subject: Uploading MP3 to server

Just looking for advice from anyone who's attempted something like this in the past:
I'm making a program consisting of a server, which listens for connections and receives mp3 files, and a client which connects to the server and is able to upload said mp3s. My question is: out of the following, would it be best to implement:
1) a Net.OpenURLConnection initiated by the server, essentially making the client program a server, and the server a client that downloads the file
2) Client-initiated Net.OpenConnection, using
a) net stream read/write
b) net stream put/get

I have tried various combinations of 2), with varied results such as unwanted line breaks, unknown net module errors, and character errors.

Essentially, my question is, what is the best way to reliably transmit binary files over a network.

I know others have tried this, but their posts lack specifics.
Sponsor
Sponsor
Sponsor
sponsor
S_Grimm




PostPosted: Thu Oct 16, 2008 3:05 pm   Post subject: RE:Uploading MP3 to server

think about a peer to peer connection type option. with it you can pause a download whenever and start it up again whenever.
chrisbrown




PostPosted: Thu Oct 16, 2008 3:18 pm   Post subject: RE:Uploading MP3 to server

That's essentially what I'm doing. I'm in rez and I'm trying to set up a centralized audio server on my floor that allows other people to upload their music to a play queue. Pausing isn't an issue; the file should ideally be transferred in it's entirety in less than a minute. All I'm looking for is a copy method that is reliable and accurate, i.e. byte-by-byte equivalence to the original file.
S_Grimm




PostPosted: Thu Oct 16, 2008 3:31 pm   Post subject: RE:Uploading MP3 to server

in essence, all code is binary, right? can you convert the song to binary and have the server recompile it to mp3 one it is completed? Then all you would have to do is have the program transfer the binary code. if it is interupted, it can resume from whence it left off.
r691175002




PostPosted: Thu Oct 16, 2008 8:36 pm   Post subject: RE:Uploading MP3 to server

Is turing really the best language to do this in? I have never used turing but it has always been more of a learning language than a practical one and I would not be the least bit surprised if its networking classes were only designed to work with strings or automatically insert unwanted line breaks like you describe.

Unless there is a way to go to a lower level the only advice I can give you is convert the binary data to some form of string representation (like hex or preferably base-36+), transfer that, and then convert it back into binary. It will balloon the transferred data by a significant amount (Probbably 5-20x) but if its over a LAN that wont be a massive issue if its your only option.

I can say that this program would be trivial to write in most other languages.
Zeroth




PostPosted: Thu Oct 16, 2008 10:35 pm   Post subject: Re: RE:Uploading MP3 to server

A\V @ Thu Oct 16, 2008 12:31 pm wrote:
in essence, all code is binary, right? can you convert the song to binary and have the server recompile it to mp3 one it is completed? Then all you would have to do is have the program transfer the binary code. if it is interupted, it can resume from whence it left off.


... Wow. No offense A/V... just wow.

Anyway, the correct way to do it is to open a stream on both sides. Normally, in an actual language(ie, not a toy language like Turing), this is relatively easy. Then, you pass data through the stream, in binary mode. In addition, you also need to send along the file attributes, which the server would then apply to the new file. By file attributes, I mean stuff like time accessed, created, privileges.

Now, however, there is still a lot that needs to be done, no matter how simple I make this sound. If you want something that is actually usable, secure, and robust... just FTP.
S_Grimm




PostPosted: Mon Oct 20, 2008 10:51 am   Post subject: RE:Uploading MP3 to server

in theory, it can be done... in theory. my question is this: why don't you just have the server mapped as a storage device? then you would be able to pull up whatever song was put on it.
chrisbrown




PostPosted: Mon Oct 20, 2008 11:32 am   Post subject: RE:Uploading MP3 to server

The idea was that anyone on the floor would be able to have their music queued up on a floor-wide playlist with no server-user interaction at all. But our don made us take everything down - i.e. 600 feet of speaker wire that was running through the halls - so I don't see this going anywhere soon.
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Mon Oct 20, 2008 6:29 pm   Post subject: Re: RE:Uploading MP3 to server

methodoxx @ Mon Oct 20, 2008 11:32 am wrote:
The idea was that anyone on the floor would be able to have their music queued up on a floor-wide playlist with no server-user interaction at all. But our don made us take everything down - i.e. 600 feet of speaker wire that was running through the halls - so I don't see this going anywhere soon.
Check out available solutions to parts of your problem. For example, if you can dedicate a machine to playing MP3s and streaming, you can have Windows Media Encoder, or something similar stream your WAVE input.
gitoxa




PostPosted: Mon Oct 20, 2008 9:33 pm   Post subject: RE:Uploading MP3 to server

I'm sure it wouldn't cost too much to get some delicious wirelessness set up.
md




PostPosted: Mon Oct 20, 2008 10:56 pm   Post subject: RE:Uploading MP3 to server

Why not use mpd and icecast? then use a web-based mpd client and you're set.

Setup is *much* easier then writing your own client and then the only hard part is getting other people's music onto the server. For that there are plenty of wonderful filesharing technologies, from p2p to windows file shares to the much more reliable and useful in this case USB key.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: