Ever Have Trouble Sending Things Between Your Home Computers? … Me Too

19 01 2008

If you’re at all like me, I always have my friends bringing their computers over. We like to share stuff obviously, and although I always come up with some solution to the problem of “How do I get this file from my computer to yours?”, it’s never really the best answer, and generally involves a lot more work than it really needs to.

Last night, I was having a little LAN Party with 2 of my friends, and we were just hanging out playing all sorts of games like we do occasionally. But then of course one of my friends says, “Hey Ryan, lemme give you this file.”. Alright…too bad we don’t have a way for you to send it to me.

First try: “I’ll share a folder over the network and you can just drop it in there!” – FAILURE – Computers not in the same windows work group…

Second try: “Get on AIM, I’ll just send it to you!” – FAILURE – AIM sucks, and for whatever reason, I can never use it to send or receive files from any of the people that it matters for.

Third try: “Oh hold on I’ll put it on my USB Drive!” – FAILURE – “F***! I can’t find it. “

At this point, we are all angry. Suddenly I was struck with a thought. “Why don’t I just make my own program for LAN file transfers?”. Brilliance. Next came, “Why did it take me so long to think of that…”

So I spent a good bit of last night programming the night away like I generally do. I decided to write a simple thing in C#. Its nothing complex but it almost works. I’m having trouble making it so you can send files over about 50 MB though, which is a problem…

I get an exception on this line:


i = stream.Read(bytes, 0, bytes.Length);

It gives me an IOException and says:

Unable to read data from the transport connection: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

I’m not really sure what to do about that. I’ve tried fiddling with a few things, but it didn’t do anything. I’m going to ask one of my friends who is a professional developer about it when i talk to him next. If anyone else has suggestions, though, I would really appreciate them.

So thats pretty much what I’ve done recently. Nothing huge, but hopefully once I get past this error it will be done. I’ll let ya know once I get it completely working. If someone would like to download it or use it, I will prolly package it and put it on one of my servers and post a link.





Great News For me – Less Work!

7 01 2008

Despite last nights extreme anger over the fact that I thought I was going to redo the structure of my Fizzure application, I learned today that I most likely do not! And this simple fact makes me very happy. There is almost nothing I hate more than having to redo work.

I came into school this morning with some of my code in hand and went straight to my computer science room. My teacher (the ever brilliant Dianne Meskauskas) took a quick look at my code. As it turns out I had just made a small mistake of where I had placed the creation of one of my objects.

The error I kept getting was a NullObjectException when I tried to access an array. I had made the creation of the object inside of a timer, so each time the timer ticked, it was creating a new object. On the first time it ticks, it creates the object “o” of the OptionControl class and fills the array SharedDirectories. On the second tick, it recreates “o” and tries to access the now empty array SharedDirectories, thus giving me the NullObjectException

Here is the little code snippet :

private void timer1_Tick(object sender, EventArgs e) {
OptionControl o = new OptionControl();
if (count == 0) {
loadWhat.Text = "Finding Shared Directories...";
o.SharedDirectories = o.getSharedDirs();
} else if (count == 1) {
loadWhat.Text = "Scanning Directories...";
o.DoScan();
} else if (count == 2) {
loadWhat.Text = "Shared Directories Found!";
} else {
Dispose(false);
}
count += 1;
}

My mistake here is on the first line. This line needs to be taken out of there and made as a class variable instead of inside a method, that way it can be accessed from any of the methods and have the same data as well.