• 0

[C#] Basic File Sending


Question

3 answers to this question

Recommended Posts

  • 0

Well, first, you seem to have a perspective problem. It's a basic task, but that doesn't necessarily mean "simple."

Several ways you could do it. You could implement a webservice on the server and have the client pass the data that way (that's probably the simplest way to do it, but also the most verbose in terms of web traffic), you could manually open a socket on the client and implement a TcpListener on the server (the most difficult, but also the most efficient), you could use HTTP to transfer back and forth, or you could be more eccentric and use FTP.

The "best way" really depends what you're trying to do. If it's a small amount of data you're looking to transfer, making things easier on yourself and using a webservice would probably be best. If you're looking at lots and lots of data or lots and lots of clients, doing everything manually with sockets is harder to do, but it's "best" in that case because it's easier on the connection; FTP would also be good in that case (it was designed to transfer larger amounts of data than the other available protocols), but it's also going to be much harder to implement -- unless you buy an FTP component.

  • 0

There isn't really a clear cut answer in that case. FTP would be too cumbersome for lots of small files like that. Sockets, of course, would give the best performance, but you need to evaluate whether you need that or not. If your machine can handle that much traffic coming in, plus the processing power needed to unpack the data when it gets to the server, plus whatever processing you're doing on the files to begin with, then go with a webservice. If you've already got the machine doing a lot of data crunching, then sockets would be better.

Alternately, you might want to try HTTP, since it was designed for that type of scenario (lots of small files, in lots of requests). In that case, I would have each client log into the server, and have the server sent HTTP requests to the clients every minute. (have the server pull the data from the clients rather than the clients pushing the data to the server)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • One can also use fastFetch. Gives you a quick hardware spec in a CMD or PowerShell console: https://imgur.com/a/fastfetch-kC0E3xT
    • Looking back at your message, you mention "less harsh terms." If by that you mean that requiring the pentagon to pass an audit is harsh, then to that I would say, that was already passed into law back in 1990. I wasn't planning to debate if that law was reasonable or not. If you are calling it harsh, then that is your opinion and we can disagree, but our options matter little considering it passed long ago. If you don't think the law itself is harsh, then I really can't understand how a reasonable enforcement of said law could be considered harsh either.
    • I have a strong feeling more than one store did that, and idk who is to blame more, Nintendo's terrible choice of packaging layout, or the sellers. I can't wait to see some class action lawsuit if Nintendo or said retailer doesn't step up. The question is what wonderful name we can come up with for the thing. Screengate(Staingate) already happened with Apple, so that's taken.
    • I'm definitely like this. I carry my rucksack everywhere with me and feel quite naked without it on my back. What if I need my laptop? What if the guys want to play a game of Magic? What if I need a plaster, or rubber gloves? Or my lockpicks and binoculars? Or my chessboard set? Or my portable power bank for my phone? I can't go anywhere without it, it's a life saver.
    • Bethesda's Deathloop is free to claim on the Epic Games Store this week by Pulasthi Ariyasinghe The Epic Games Store's Mega Sale promotion is in its final week, and that means mystery giveaways are soon ending too. For the finale, Epic Games has called in something big from Bethesda, with the Arkane-developed time loop adventure Deathloop coming in as the latest freebie for PC gamers. Alongside it, the indie adventure Ogu and the Secret Forest is also free. Developed by Arkane Lyon and published by Bethesda, Deathloop comes in touting an action-packed campaign involving plenty of time travel shenanigans. The game is set on the mysterious island of Blackreef, where two rival assassins, Colt and Julianna, are trapped in a time loop. The player, as Colt, has to figure out how to eliminate eight targets within a single day to escape the loop. Each of the assassinations can be taken care of in many ways, including stealth, traps, accidents, or simply going in guns blazing. Aside from gunplay, the title also makes use of supernatural systems very similar to the studio's Dishonored franchise, letting players teleport, go invisible, use telekinesis, and more. There is a multiplayer twist here too, where players, as Julianna, can invade the campaigns of others to take the role of the rival assassin, flipping the tables on the main character and his plans. As for Ogu and the Secret Forest, this is a 2024-released indie adventure featuring hand-drawn characters and various types of puzzles. The 2D game involves befriending characters across a fantasy land as baby Ogu, with plenty of exploration, puzzle solving, and boss battles available. The Deathloop and Ogu and the Secret Forest giveaways are now live on the Epic Games Store for all PC gamers. The promotion is slated to last until June 12, giving you seven days to claim a copy for your library permanently. While the summer mystery giveaways are ending, regular freebies will continue to arrive from the Epic Games Store. When this one comes to an end on Thursday, the SEGA-published humorous hospital simulation entry Two Point Hospital is incoming as the next giveaway.
  • Recent Achievements

    • Week One Done
      jbatch earned a badge
      Week One Done
    • First Post
      Yianis earned a badge
      First Post
    • Rookie
      GTRoberts went up a rank
      Rookie
    • First Post
      James courage Tabla earned a badge
      First Post
    • Reacting Well
      James courage Tabla earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      407
    2. 2
      +FloatingFatMan
      181
    3. 3
      snowy owl
      176
    4. 4
      ATLien_0
      171
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!