I’m using a FEZ Cobra board, passing in the following parameter values to this function:
[line]
server = “stream.twitter.com”
port = 80
[line]
private static Socket ConnectSocket(String server, Int32 port)
{
// Get server's IP address.
var hostEntry = Dns.GetHostEntry(server);
// Create socket and connect to the server's IP address and port
var socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
socket.Connect(new IPEndPoint(hostEntry.AddressList[0], port));
return socket;
}
[line]
The “socket.Connect” function is throwing this error:
#### Exception System.Net.Sockets.SocketException - CLR_E_FAIL (5) ####
#### Message:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
#### CobraConsole.WebClient::ConnectSocket [IP: 001b] ####
#### CobraConsole.WebClient::GetContent [IP: 000c] ####
#### CobraConsole.Program::StartMonitoring [IP: 0029] ####
#### SocketException ErrorCode = 10035
#### SocketException ErrorCode = 10035
A first chance exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
#### SocketException ErrorCode = 10035
An unhandled exception of type ‘System.Net.Sockets.SocketException’ occurred in Microsoft.SPOT.Net.dll
[line]
Any ideas why I’m getting a socket exception?
I’m thinking it has something to do with Twitter not accepting the connection, but not sure.