Click here to Skip to main content
15,914,371 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've tried lot of examples of socket programming in c# it transfer files between computers in my network but it wont transferring files over wifi. How i do that using c#?
Posted

1 solution

You certainly can do it in a number of ways, because sockets are sockets, very similar on different platforms, but one approach would be the most straightforward: writing the same code on both platforms using C#. To use C# and other .NET languages on Android, you need an alternative CLR implementation, the one which can work on Android. Such thing does exist:
http://en.wikipedia.org/wiki/Mono_%28software%29[^].

Unfortunately, Mono for Android (MonoDroid) is commercial. There is the open-source equivalent based on ported Mono build: https://github.com/koush/androidmono[^].

—SA
 
Share this answer
 
Comments
jeffingeorge 10-Feb-14 3:32am    
So i have to implement the same code on both devices ?
Sergey Alexandrovich Kryukov 10-Feb-14 12:17pm    
What would be the problem? One application works as TcpListener, another as the TcpClient, connect to listener, they read/write blocks.
WiFi makes no difference. You need to have a network between devices, say, ad-hoc network. This is unrelated to programming on your side.
It was you idea about socket programming, not mine. I would not do it. I would, say, run some standard FTP server on one side, another acting as a client... It depends on how you want to have it...
—SA
jeffingeorge 10-Feb-14 22:48pm    
Can you show me a example ? with file transfer?
Sergey Alexandrovich Kryukov 11-Feb-14 0:20am    
Needs too much time. But it's simple: read from file steam, by some chunks, write to network stream. On another side, do the opposite. Take care about last block with the size possibly less than a full chunk...
—SA
jeffingeorge 11-Feb-14 0:23am    
:(

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