Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Hey, I have been looking on google and I cannot seem to find anything about peer to peer transfer.
Basically, I want to be able to send a file from my computer to someone else's computer. Does anyone know of any guides that can help me with this?
Thanks.
Google "System.Net.PeerToPeer", a namespace available in the .NET 3.5 framework. You'll have no trouble finding docs and sample code.
If you really just want to "send a file from my computer to someone else's computer" using C# then you may not be looking for true p2p. You can just use raw TCP. For this you need the remote computer to listen for a connection, your computer to open a connection to the remote computer, and start sending data.
There's a very basic example on how to do something like that here.
If you are actually looking for true P2P then you're best off using an existing P2P network (otherwise there will be nobody but you and your other computer on it). There are a few C# BitTorrent libraries around - for example BitSharp, TorrentNet. There is a whole question about BitTorrent libraries written in pure C#.
If the destination computer is able to expose a URI to publish to then you can simply use
WebClient.UploadFile(Uri address, string filename)
It very simply just takes a URI as address (http, ftp, even the file protocol to transfer to a folder share).
But that does require setting up something server side to publish to, but it would be platform independent on the server (e.g. any old FTP server, or a web page or service that accepts a file by POST method). Security may be an issue you need to consider however.
That's using a push model. WebClient can also be used from the other side to download. It also supports transfer of data streams, strings, etc.
Have a look at this project on Code Project.
It provides for P2P chat and file transfer and could be either an inspiration or a solution.
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What are the upsides to using an FTP server (hosted by a third party) to transfer (and maybe store) files when compared to just sending through email? The language of choice is C#.
Email looks easier to implement and if it was going to Gmail then server hosting and upkeep would not be a worry. However, I am not experienced with FTP servers and don't know how big of deal setup and upkeep is on them. All that is being sent is a bunch of text files, most likely each under 1 MB. Security is not a big deal at this point, but I am curious which is more secure without doing a lot of extra setup work.
Emailing means you have no guarantee that the file is received at the other end, or in a timely manner. Maybe this is not important for you? Emailing certainly would be easier to program up compared to FTP.
On the other hand if you use one of the many FTP libraries available for .NET then have complete control. You could include the library in a C# windows service to do the transferring seamlessly for you including exception (error) processing and notification.
Personally I'd take the opportunity to learn about FTP (its easy). You would of course require a FTP service to be setup on your server. All part of the learning.
I don't know your specific use case, but it sound like FTP is more appropriate than email for transferring and storing files. I mean it is called the "File Transfer Protocol" for a reason ;) The upside of FTP over Email is that it is designed for files while email is designed for email messages - it will be more difficult in automating the management of file attachments in email.
Setting up an FTP server is not difficult. Check out FileZilla:
https://filezilla-project.org/download.php?type=server
Sending files via FTP with C# is not difficult either. Here is question on that:
Upload file on ftp
BTW, again without knowing your requirements, there are also cloud services like Dropbox and Box.com that have APIs that might be even more appropriate for you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Im new app developing, beware. I want my windows phone app to access a text file from my dropbox and display the information in a textblock by binding it. Does anyone know how can I accomplish this?
or if anyone knows another site where I can upload my text file instead of dropbox, please share. I just don't want to hardcore all the info to the app.
Try to find an existing API that meets your requirements. That would be:
.NET Dropbox Client Library
Compatibility with WP
Some Dropbox client libraries are recommended here.
It looks that both sharpbox and dropnet are WP7 compatible.
Use them to get information about the file / to get the file.
Also if you are new to WP7 programming you might want to check some of these resources:
MVVM in WP7
Code samples
http://pastebin.com/ is a great place to dump text files, or a public FTP server, maybe someones website it doesnt really matter for the purpose here anywhere is alright aslong as you can call a single URL to the file without having to authenticate or do some APIs to access a store.
personally I would just upload the Text File anywhere here is an example of my paste
http://pastebin.com/raw.php?i=a0TLDiaM
make sure you gather the RAW link to the file as opposed to the standard webpage
then use a Webclient to downloadStringAsync, for examples on this see
http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I am looking for a solution to allow me to read incoming emails. The three methods I can think of to do this at the moment are:
Create an Email Server parsing emails
Hook into an existing exchange server
Hook into outlook that is already set up with an email account
What is the best way to do this? And how does one go about implementing it?
Thanks
If you are already dealing with an Exchange server as the mailbox host I would suggest leveraging that via IMAP (preferred) or POP access. Recently I developed a solution that accesses a specified mailbox via AfterLogic's MailBee.NET IMAP component which I think is worth the recommendation. They have a standard trial version and reasonable pricing. Also if you go this route either POP or IMAP automation is flexible enough to work with almost any mailbox server platform; It doesn't have to be limited to Exchange environments.
There are also free .NET IMAP components out there that may do the job as well. In my limited research I found that the free alternatives didn't quite meet all of my requirements or were not as easy to learn but your situation may differ. For completeness, here is a list of alternative / free IMAP libraries I considered before deciding to spend the money on MailBee:
ImapX - http://hellowebapps.com/products/imapx/
LumiSoft.Net Imap Client - http://www.lumisoft.ee/lswww/download/downloads/Net/
InterIMAP - http://interimap.codeplex.com/
To address the 2nd part of your question... The implementation in my recent project involved writing a very simple console application that references the MailBee.NET IMAP library. The console application has a standard config file and accepts command line arguments as parameters. We define Windows scheduled tasks to run the console application according to our process needs. I am sure you could do this any number of other ways but this was the simplest approach for our needs.
I know this is an older thread but I wanted to add a link to a great open source Imap library called ImapX2: http://imapx.codeplex.com/
I tried most of the links in this thread to varying degrees of success but I found that the ImapX2 library work the best according to my needs.
Use existing IMAP server and IMAP component for that.
Creating your own IMAP server is a big security risk in my opinion.
There are free components, but most of them have problems with national characters and 'not standard' email messages...and there is none support (LumiSoft.Net is abandoned for almost 2 years)
using(Imap imap = new Imap())
{
imap.Connect("imap.server.com");
imap.Login("user", "password");
imap.SelectInbox();
List<long> uidList = imap.Search(Flag.Unseen);
foreach (long uid in uidList)
{
IMail email = new MailBuilder()
.CreateFromEml(imap.GetMessageByUID(uid));
Console.WriteLine(email.Subject);
Console.WriteLine(email.Attachments.Count);
}
imap.Close();
}
Mail.dll also includes SMTP component and template engine so you can send replies easily.
Disclaimer: I'm involved in the development of this commercial product.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm looking for a way to listen on a specific port as a VNC server, then be able to send whatever I want to the connected VNC client.
There's a lot of VNC client components, but I've not yet found a .net VNC server component.
I intend to use this to allow a client to connect directly to my windows form (and only the form, so they don't see any desktop, just my window). I realise this would normally cause input issues, but I will be forcing the clients to connect in view-only mode.
I'm very familiar with the various User32/Gdi32 platform APIs for capturing a window's contents to an image, so if it's a case of writing image data to a VNC server stream, that's fine too.
Where should I start? Is there an existing VNC server component that does what I'm describing? If not, is anyone aware of a RFB protocol component that makes it easier to communicate with a VNC client, perhaps even performing the image diff and sending only the changes?
It isn't a component, but Alkit VNC does seem to do what you're asking, which is share a single window using a VNC server. The source is available, too.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Does anyone knows of any .Net library or resources that will assist me to implement a TCP port scanner?
For simple one, that will just try to connect to each port and report success / failure, without any "tricks", like sending only ACK packets etc. - you won't need anything else than System.Net and System.Net.Sockets, create socket, try connecting to a host, check if you have succeeded. For better performance, you can create more sockets, and use asynchronous approach (BeginConnect/EndConnect).
I found some example codes.
http://www.geekpedia.com/tutorial142_Creating-a-Port-Scanner-with-Csharp.html
http://www.dijksterhuis.org/building-a-simple-portscanner-in-c/
WinPcap is a network monitoring and packet capturing tool but it might be also useful because it is another way to get an idea about network transmissions. But it may not suit to your requirement.
You can try my open source program here ;)
http://dercousin.xhost.ro/index.php?option=com_content&view=category&layout=blog&id=35&Itemid=53
You can use Pcap.Net to create and send raw packets.
You can also capture packets using this framework.
It includes a packet interpretation and creation framework so it should be pretty easy to create the packets you need to scan the ports and to parse the packets returned.