SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: Direct file transfer program
-
Oct 24, 2005, 19:52 #1
- Join Date
- Jan 2003
- Location
- New York / Boston
- Posts
- 593
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Direct file transfer program
Hi all,
I want to write an app that allows two people to quickly and easily transfer files between each other (something like directIM in AIM and GAIM). The motivation behind this program is that I hate setting up a ftp server, or attaching to emails when all I want to do is send a small file.
I've done some simple network programming here in college (basic TCP/UDP socket stuff) so I want to know if there is any more that is required for entire file transfers?
I'm also planning to do this in ruby (since it seems to be the talk of the town). Does anyone have any experience with this sort of application (in any language really, but Ruby specifically).
thanks
Kevin
-
Oct 28, 2005, 07:52 #2
- Join Date
- Oct 2005
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
There's a buddy of mine who was talking about doing something similar
A buddy of mine was talking about doing something similar to what you're talking about. I think it is pretty much as simple as what you're thinking. The only thing you would want to be wary of are firewall issues, but if the ftp solution is already working for you, then that probably isn't a problem.
Good luck
-
Oct 29, 2005, 11:17 #3
- Join Date
- Nov 2004
- Location
- Yakima WA.
- Posts
- 100
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It sounds like you have ruby on both ends? If so one solution would be to use webrick, a pure ruby web server that is in ruby's standard library. You can get more info here: http://www.webrick.org/. Here is an example of how easy it is to create a simple http server:
Code:#!/usr/local/bin/ruby require 'webrick' include WEBrick s = HTTPServer.new( :Port => 2000, :DocumentRoot => Dir::pwd + "/htdocs" ) ## mount subdirectory s.mount("/~username", HTTPServlet::FileHandler, "/home/username/public_html", true) #<= allow to show directory index. trap("INT"){ s.shutdown } s.start
Code:require 'open-uri' remote_file = open("ip_address_of_server:2000/test.tar.gz").read File.open("test.tar.gz", "w+") do |file| file.write(remote_file) end
-Ezra
-
Oct 30, 2005, 22:58 #4
- Join Date
- Jan 2003
- Location
- New York / Boston
- Posts
- 593
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hey guys thanks for the tips. I'll look into. If Ruby doesn't work out, I might just do it in java...but I really dislike Swing.
-
Oct 31, 2005, 05:58 #5
- Join Date
- Jul 2004
- Location
- Gerodieville Central, UK
- Posts
- 446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
*Shivers at thought of Java*
I hated Java before I got to university. Now I really detest it with a passion now I have to use it.
Only thing I found with Webrick is there aren;t many resources on the net explaining how to use it for custom work. I guess I've just not channeled enough time into looking into it though.
-
Oct 31, 2005, 19:58 #6
- Join Date
- Jan 2003
- Location
- New York / Boston
- Posts
- 593
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
More questions.
How difficult is it to use WxRuby? Is it possible to make a standalone exe, which is runnable on linux and windows? Sorry for noob questions.
-
Oct 31, 2005, 20:00 #7
- Join Date
- Jan 2003
- Location
- New York / Boston
- Posts
- 593
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by ezmobius1
-
Oct 31, 2005, 20:33 #8
- Join Date
- Nov 2004
- Location
- Yakima WA.
- Posts
- 100
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, I leave that as an excercise to the user
. Seriously though, you might wnat to consider using xml-rpc on both ends. Its fairly easy to do with ruby and there is some security built into that protocol. And you can send files that way to after you base64 encode them.
But I guess I would like more information about the app you want to write before I can give much better response.
Details please?
-Ezra
-
Nov 2, 2005, 07:19 #9
- Join Date
- Oct 2005
- Posts
- 6
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by khu19
I don't know anything about wxruby, so I can't comment on that, I have used rubytk and have found that to be an easy toolkit to learn and use, (and it has the benefit of working out of the box on both windows and linux).
for a standalone exe look for a gem called rubyscript2exe
this will make an exe with the ruby interpreter packeged in with the script. It's not really a compiler, but it does give you a single file that you can just run as though it were an exe. I believe if you want to distribute to both linux and windows, you will have to create two seperate files with rubyscript2exe, one for linux and one for windows.
PS, I've had more luck using rubyscript2exe on windows than linux, but I suspect this has to do with the fact I'm on unbuntu and am using the ubuntu packages which are configured strangely, if I had built ruby from scratch, I suspect this problem would disappear.
hope this helps.
Bookmarks