• Unit Testing Sockets

    So I've been playing around with .net's network sockets a little bit for a project I'm working on. Here's a little factory pattern to generate up a send and receive socket so that you can test things.

     

      public class ClientAndServerSockets

        {

            public Socket Client;

            public Socket Server;

            /// <summary>

            /// Factory Generates a client and server socket to use in testing

            /// </summary>

            /// <returns>a client and server socket</returns>

            public static ClientAndServerSockets RetrieveSockets()

            {

                ClientAndServerSockets retval = new ClientAndServerSockets();

                Socket listener = new Socket(AddressFamily.InterNetwork,

                SocketType.Stream, ProtocolType.Tcp);

                listener.Bind(new IPEndPoint(IPAddress.Any, 4000));

                listener.Listen(20);

                IAsyncResult iarAccept = listener.BeginAccept(null, null);//begin listening

                retval.Client = new Socket(AddressFamily.InterNetwork,

                SocketType.Stream, ProtocolType.Tcp);

                IAsyncResult iarConnect = retval.Client.BeginConnect(new IPEndPoint(new IPAddress(new byte[] { 127, 0, 0, 1 }), 4000), null, null);

                retval.Server = listener.EndAccept(iarAccept);

                retval.Client.EndConnect(iarConnect);

                listener.Close();

                return retval;

            }

        }

    Basically, I use Async calls to setup a listening socket then while that's on another thread doing "Accept" I do an async Connect on the other socket. I close out the listening port after I have my two connections and return them. The container class is used so that I don't have to do 'out' parameters.

    Full story

    Comments (0)

  • Fastest Growing Jobs of 2008-09 outlook!

    http://www.bls.gov/news.release/ooh.t01.htm

    I found this pretty interesting... but i swear it was formatted by an html programmer III at the government.

    I was going to look at the numbers but the formatting is just too idiotic to work with and i'm much too lazy tonight.

     

    I will leave you with these words to think about.

    "If you are not studying to be in healthcare or computers, then you are an idiot"

     

     

     

    Full story

    Comments (0)

  • reCaptcha does not work on GoDaddy.com

    So reCaptcha, my spam protection does not work on godaddy.com.

    I found this blog post that goes a little more in depth. I already suspected (thus the googling of that blog post).

    So reCaptcha is now disabled by god because i want to save 5 bucks a month and i'm sure theres other spam protection solution that doesn't need to talk to an external server

    Full story

    Comments (0)

  • Go daddy is sucking...

    So, i moved my blog hosting from discountasp.net to godaddy.com. I am super excited to pay half as much per month for hosting AND be able to use SQL server instead of MS Access lol :)

    I got everything converted to SQL but i lost the comments in the process :) whups. And logins don't work for some reason (but they work remotely so that's how i am posting this).

    Anyhow, hindsight is 20/20 i should have kept both hosting services until i had everything configured properly.

    Full story

    Comments (0)

  • Mike Cohn explains scaling and estimating

    Skip the first 30 seconds

    Full story

    Comments (0)

  • A day in scrum

    whoa this is cool

     

    Full story

    Comments (0)

  • Cloud Computing is just a buzzword?

    This is hilarious... do you agree there's nothing substantial to cloud computing?

    Frankly, i think he's right about one thing... Cloud Computing has been redefined to be everything we already do. using web services, using web sites and applications...

    I think it's easier to define cloud computing by saying what it's NOT.

    Cloud Computing is NOT:

    1. Software that doesn't use the internet to deliver it's value to you.
      1. excel
      2. ms word
      3. single player video game on your pc
      4. mp3 ripper/dvd ripper

    Full story

    Comments (0)