the getsockname function requires an int *, not an int with the size of the structure, so I needed to create a variable and initialize it to the size of the structure I was passing in.