The problem with the time response to the TCP request

Recently I’ve tried to make simple application which work as web-application through sockets. First I turn on listening of the specific port:

    // Turn on listening of Tcp/Ip port
    tcpListener = new TcpListener(IPAddress.Any, port);
    tcpListener.Start();

Then in thread I check if there is some request on the port. I’ll open socket only if there is some request there.

                    // Work through sockets only if request is available
                    if (!tcpListener.Pending())
                    {
                        Thread.Sleep(100);
                    }
                    else
                    {
                        handler = tcpListener.AcceptSocket();
                        string data = null;

                        byte[] bytes = new byte[1024];
                        int bytesRec = handler.Receive(bytes);

                        data += Encoding.UTF8.GetString(bytes, 0, bytesRec);

                        if (data.IndexOf("GET / HTTP/1.1") > -1)
                        {
                            GetIndexPage(handler);
                        }
                        handler.Shutdown(SocketShutdown.Both);
                        handler.Close();

                        Thread.Sleep(100);
                    }

It should work fast. And it works pretty fast if I use the same code for computer. But on my Colibri VF50 with WEC 2013 (the same with Windows 6.0 CE) some requests could be handled after 30 seconds or even more. And it’s not my handling of request data in GetIndexPage(). As I saw with the help of breakpoints, sometimes tcpListener.Pending() doesn’t see any request immediately. And it gives that delay.
Does anyone have any suggestions for this issue? How could I make this delay less?

Can you reproduce the same issue in C? I am not sure how networking part of .netopencf works.

It’s not .OpenNETCF. It’s .NETCF. I use System.Net and System.Net.Sockets namespaces.
I’ll try to port it into C, but I’m not sure how to repeat Pending() method with WinAPI functions.