• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

FTP(File transfer)

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
I would like to transfer files from client to server with out using sun ftp package.As of now, the file content is being read and sent to the server but the file is being copied on to "sentfile.txt". So whatever file i send from the client, its been written on the sentfile.txt.(Thats how I've written in the following code but have no clue how to get the actual file which I've sent from the client.Any help would be appreciable.
I think, I've to read the file at the client using a file i/p stream and then write bytes to socket o/p stream.At the server, I've to read the bytes using the socket i/p stream and then write those bytes to file o/p stream.

Thanking you in advance
Client Code:

Server Program

[ February 16, 2004: Message edited by: kimi lynn ]
 
kimi lynn
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder where am sending the file name to the server,huh!
 
kimi lynn
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could somebody pls post the code of Jeff Holmes Contribution regarding ftp using sockets.I found the URLdead.
Thanks in advance
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the context it looks like he was talking about FTP as in File Transfer Protocol. I don't think you are looking for a full-blown FTP client, you just want to upload a file name then a file. Of course, this would require creating your own protocol. Take a look at the Custom Networking part of the Java Tutorial, specifically the Client/Server Pair example.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic