IronLanguages/main — pull request #213 by fdanny (2014-08-17 23:28:29+00:00)
Title: changes to #23829, #23742, #23853, and implemented getservbyport and get...

Only the socket.cs file. I don't play with git alot so who knows if I did this right.

item# 23853
On socket.recv timeouts CPython throws a socket.error instead of socket.timeout exception.
I didn't know how to access timeout from MakeException fuction so I check where the exception occurs at the recv function and raise a socket.error exception instead and the error message is similar to CPython 2.7.8

item# 23829

Change the exception thrown I throw PythonOps.ValueError("Timeout value out of range") instead of TypeError

item# 23742
I implemented a getservbyport (if approved below) which is called in the getnameinfo so it doesn't have to informce the NI_NUMERICSERV flag. Lets see what you guys think.

Others changes from running tests
1.
getservbyport and getservbyname are not implemented in the .NET framework. I created a simple switch statement that returns either the service name or port based on the input. I just picked a few services and ports to be mapped. I could have pinvoke to Windows but not sure if it would be a good idea to be tied to Windows only to implement.

2.
I check the input size of bytes on the socket.recv functions and threw the appropriate exceptions.

if (maxBytes < 0)
throw PythonOps.ValueError("negative buffersize in recv");

To throw the same exception as CPython 2.7.8 if the input is less than zero

3. socket.getaddrinfo

if host is null I assign it to localhost like CPython 2.7.8