LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-18-2007, 12:24 AM   #1
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Rep: Reputation: 30
regarding ftp


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.

please help me ..
thank you in advance
 
Old 07-18-2007, 02:25 AM   #2
nc3b
Member
 
Registered: Aug 2005
Posts: 330

Rep: Reputation: 32
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.
 
Old 07-18-2007, 04:16 AM   #3
munna_dude
Member
 
Registered: Dec 2006
Posts: 362

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by nc3b
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"..
Quote:
s1=g_strconcat("cp -i ",split1_filename22[1]," ", file,NULL);//cp -r
/*s1=g_strconcat("rsync -v -c -r -u -l -H -P -t --progress ",split1_filename22[1]," ", file,NULL);
s1=g_strconcat("rsync -navz --progress --inplace ",split1_filename22[1]," ", file,NULL);*/
g_print("saved file==== %s \n",s1);

FILE* F;
F=popen(s1,"r");
pclose (F);
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.

can you help me.

thank you in advance
 
Old 07-18-2007, 10:05 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.

--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
when I use ftp://user@ftp.blah.com it works. But when I type just ftp.blah.com says.. hunterhunter Linux - General 15 03-05-2014 09:12 AM
In plesk , I wish to have a backup cron job, ftp back up file to another ftp server? muskiediver Linux - General 6 07-16-2009 03:13 AM
FTP Server Up and running... how do I hide ftp users from local login screen? joe1031 Mandriva 2 03-18-2005 04:24 PM
problem with ftp on mandrake 10.1 Official, ftp speeds system wide (anybody noticed?) equinox Mandriva 15 11-10-2004 02:07 PM
how can I restrict ftp users listing files from a pure-ftp server adrianmak Linux - Networking 2 12-31-2002 08:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration