Main Site Documentation

@Wouter Huysentruit Have a question about your example


#1

I have been playing arround with web server examples and i thought i was starting to get an understanding of how it works until I found your example which works great but blew my understanding out the door.

Seems many people start the network like this:

Microsoft.SPOT.Net.NetworkInformation.NetworkInterface NI = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0];

Socket serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

Yet with your example it was not done this way.

So now that i see there are 2 ways to start a listening socket, what are the pro’s and cons for each?
they both seem to work just fine, but i really dont understand yet just how you are doing what you are doing in there.


#2

You can use a Socket for that, but then you’ll have to implement the HTTP protocol your own. Or you could just use HttpListener which internally uses a Socket but does all the HTTP talking for you.


#3

Thanks,

so why would anyone then do it using a socket? seems it would be much better to do it the way you did so the HTTP protocol is done internally.


#4

I think HttpListener is only available on EMX.

Examples with Socket work on all NETMF boards…