Click here to Skip to main content
16,020,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi .


I am working client server based windows application. I have two console, one is client and other is server . I want to collect the file from client pc to server Pc.

How i do this?

I have tried
File.Copy() 
method,without share folder its not working.

Please help me in this.

Thanks in Advance.
Posted
Updated 19-May-11 21:08pm
v2
Comments
[no name] 20-May-11 3:08am    
Edited for easy Understandability.

If cannot miraculously work by itself. You need to provide a service contract which has a file copy operation (in case of WCF), or service interface which has a function of file copy. One well-known protocol is FTP (also SFTP, FTPS). You can simply install configure and run some FTP service on your service part, in addition to your service.

Anyway, you can always use your own application-level protocol using service interface or service contract.

By the way, I doubt you created a real service. What console? The real thing is the Windows Service; it cannot use console as it keeps working if the user log in and out or before anyone logged in.

[EDIT]

If you're not familiar with WCF, you will need to start with very beginning:
http://msdn.microsoft.com/en-us/library/ms731082.aspx[^].

This walk-through can be very helpful:
http://msdn.microsoft.com/en-us/library/ms731082.aspx[^].

You can use different levels of networking, not just WCF.
Please see my overview I've done in my previous answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA
 
Share this answer
 
v2
Comments
[no name] 20-May-11 3:20am    
Exactly. Well Said SA. My 5 too.
Sergey Alexandrovich Kryukov 20-May-11 3:23am    
Thank you, Ramalinga.
--SA
MauryaArunKumar 20-May-11 3:36am    
Please give me some idea about service contract , i have not enough idea about wcf
Sergey Alexandrovich Kryukov 20-May-11 4:15am    
This is long story. You may need a whole day or more to get into it.
Anyway, please see the update to my answer, after [EDIT].
If not WCF, I wonder what level of networking did you use in you service?

Well, if you fine it all useful, please formally accept this answer (green button).
Thank you.
--SA
If you want to use File.Copy, you need to provide network credentials for that.
http://stackoverflow.com/questions/766033/copy-file-to-remote-computer-using-remote-admin-credentials[^]
http://stackoverflow.com/questions/295538/how-to-provide-user-name-and-password-when-connecting-to-a-network-share[^]

In client-server application, client can read the file and send data to server application, and server would save it wherever it wants.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 20-May-11 3:26am    
Well, I was nearly shocked by the idea of "single application", especially by "don't need client-server". What you say is may be not single application, but certainly client-server. The server is called Windows Share service or something like that.
I would advice you to fix it and explain properly to avoid down-votes.
(I did not vote this time.)
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900