• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

copying files over a network

 
J Mangual
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i copy files over a network using a socket? I have something written but I hard-code the file size.
 
Henry Wong
author
Marshal
Pie
Posts: 21192
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
J Mangual wrote:how do i copy files over a network using a socket? I have something written but I hard-code the file size.


Well, you will need to design a protocol between the two sides -- maybe the sender can send the filename and filesize, prior to sending the bytes of the file.

Henry
 
J Mangual
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is some sample code I found while searching. Is there a way to transfer files which does not depend on the file size?

The Server:

The Client:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic