Skip to content

Comment on Show HN: Quickly copy a file between computers

Comments

Nice. Very Unix-ish in its spirit.

The client-server arrangement is backwards though :) Typical arrangement is for the clients to do the "anyone there?" broadcast, for the servers to reply and then the client would select the server, connect to it and they would go about their business. In your case, the server connects to the client. If you re-arrange this to natural client-server order, you should be able to get rid of the fork() call and this will help with portability (not that you probably care at this point).

Also,

  size = fread(&buf, 1, 100, ft)
No harm in using chunks larger than 100, especially when dispensing larger files.

Also, consider switching to multicast for discovery.

I agree with you on it being backwards and for some reason I chose to do it this way, though I can not now remember why.. may have just been a flawed though, as I can see no reason not to do it your way at the moment.

Good find on the fread, that is actually a "bug", should be MAXBUFLEN instead of 100.

Agreed on multicast, I will add that to do the todo.

Thanks for your feedback!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.