ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi all
i am trying to send a file through internet.
am doing this with my socket programming.
i know there are several softwares having this file sharing concept., but i have to develop this to my software also..( it is not wate of my time).
i would liketo use only sockets to send a file..
i am not using ssh and scp .
the process is like this.....
Quote:
1. i am registering my software.
2. and adding my friend (other user ) to my contacts..for this we can provide a didnumber(just like 11110111).
3. the buddy will show presence if he is online or not.we did successfully the IM window. we are chating each other using socket program.
4.now i am selecting an user to send a file from my machine.it opens a popup. it has a label that to send a file. i clicked on that.(and also am getting his didnumber while selecting)
5. it will open filechooser window. i selected a file.
6.and clicked a send button .. here the code is socket programing which i used to send instant messages(chat window).
7. i the backend the server can receive a that file from my machine, and sends the file using his didnumber.
8. at the other end(other user machine) he will got a popup window it says file was sending by this person.
9. he could click the save button.and it will open the path chooser window. he could select the path to save the clicks save button.
up to this i did successfully....
Quote:
10. here i tried to copy of the file.i used "rcp -p" , "cp -i" and "rsync -naz" to save the file.
but it dosnt saved..
saying that error..
i tried not only "rcp -p"
but also "cp -i" and
"rsync -naz"
Quote:
cp: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory
rcp: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory
rsync: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory....
please help me what i have to use to copy(other than "scp -p") my file to other remote user , who is registerd to my software.
at present am not tell about the software name.
I really missed this question.. I was wondering when are you going to come back )). Anyways.
You say "i would liketo use only sockets to send a file.."
Then what are you doing with rcp and rsync?
If you want to send files by only using sockets, you should use a second pair of sockets, so the transfer can go p2p. One of the clients should listen for connections, and the other would connect to it, the server specifying the connection details: ip and port. Then transfer the file just like messages, fread, fwrite etc.
Alternatively, if your server has a lot of bandwidth, you could use it to pass the file chunks from one client to another.. The only good thing I see in this scenario, is that you can shadow the ip and port of the users from other users.
I don't think this post will help you, (from my previous experience with your posts, you might just say "i am trying to send a file through internet"), but I hope so.
I really missed this question.. I was wondering when are you going to come back )). Anyways.
You say "i would liketo use only sockets to send a file.."
Then what are you doing with rcp and rsync?
If you want to send files by only using sockets, you should use a second pair of sockets, so the transfer can go p2p. One of the clients should listen for connections, and the other would connect to it, the server specifying the connection details: ip and port. Then transfer the file just like messages, fread, fwrite etc.
Alternatively, if your server has a lot of bandwidth, you could use it to pass the file chunks from one client to another.. The only good thing I see in this scenario, is that you can shadow the ip and port of the users from other users.
I don't think this post will help you, (from my previous experience with your posts, you might just say "i am trying to send a file through internet"), but I hope so.
Cheers.
thank you verymuch.
this message gave me infinity wats of power.
am sending file like just am sending IM(text message) to my user.
i am sending file successfully..
in this the last 10th point.....says..
the problem is only at receiving side..
am checking this in etheral...
by using what command i ve to save my file at other end..
so that i used "cp -i" , "rcp -p"and "rsync -naz"..
here
split1_filename22[1] is a file name which was sent by me (the other user will get this file name(split1_filename22[1]) through socket.
and
"file" is wher to save the received file..( its a path to save)
these commands also saying that same error.
what can i do.
You cannot simply invoke some existing application to receive the data, unless the data was sent using a compatible protocol or format. You should simply accumulate bytes as they are received by the receiver, and write them to disk file(s) until the end-of-file. A protocol of your own contrivance can be used to flag the end-of-file condition. Same for the file name. A very primitive protocol might be, for example,
1. sender sends a uniquely identifiable message with filename & size 'n' bytes.
2. sender sends file of 'n' bytes.
(the above two steps are apparently working now)
3. receiver reads filename & size from uniquely identifiable message, opens disk file for writing.
4. receiver reads data, writing all to open file.
5. receiver closes file after receiving 'n' bytes.
This is an extremely minimalistic approach. No error handling at all. Makes a number of assumptions about things like end-of-line translations reading text files, etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.