Client not connecting to Lidgren

I have a simple client server setup. The server is a windows service using lidgren for networking. I have a .Net library with the client code. It also has a test forms app. When I run the test app everthing works fine. When I run unity the client never connects. I get a connecting status then disconnect. The code for unity and for the forms client are virtually identical. There are no errors from what I can tell. Has anyone else used or tried to use lidgren with Unity? Has anyone gotten it working?

Here's my unity code;

void Start()
{
    NetConfiguration config = new NetConfiguration("Server");
    _client = new NetClient(config);
    Thread.Sleep(500);
    _client.Connect("127.0.0.1", Port, Encoding.ASCII.GetBytes("Hail from client"));
    _client.SetMessageTypeEnabled(NetMessageType.BadMessageReceived, true);
    _client.SetMessageTypeEnabled(NetMessageType.ConnectionRejected, true);
}

void Update()
{
    // This never evaluates to true. Status is either Connecting or Disconnected
    if (_client.Status == NetConnectionStatus.Connected)
    {
        NetBuffer send = _client.CreateBuffer();
        send.Write("Test");
        _client.SendMessage(send, NetChannel.ReliableInOrder14);
    }
}

Thanks

Check out http://code.google.com/p/lidgren-network-gen3/wiki/Unity3D

void Start()
{
NetConfiguration config = new NetConfiguration(“Server”);
_client = new NetClient(config);

     //set up the hail messages
     NetOutgoingMessage hail = client.CreateMessage();
     hail.Write("hail");
     hail.Write(UserName)
    _client.Connect("127.0.0.1", Port, hail);
}

void Update()
{
            // create a buffer to read data into
            NetIncomingMessage inc;

            // check if any messages has been received
            while ((inc = client.ReadMessage()) != null)
            {
                switch (inc.MessageType)
                {
                    case NetIncomingMessageType.Data:
			  string chat = im.ReadString();
			  Output(chat);//<- handle this however you want either display the text some how etc
			  break;
		        default:
			  Output("Unhandled type: " + im.MessageType + " " + im.LengthBytes + " bytes");//<- handle this however you want either display the text some how etc
			  break;
                }

            },going off of your code try

I have a similar problem, except that running the code through the Unity editor has connection problems. The client sends the connection request, the server receives it and sends the accept connection signal, but the client doesn’t receive it! The server keeps resending the signal and eventually gives up.It takes about a minute and three connection attempts before it finally connects. But if I build the project and run it as a stand-alone executable it connects no problem…

Unity must be doing something different when it’s run through the editor…

(note: I’ve already made the changes from the lidgren wiki as linked above)

Update: I’ve noticed that if I have the MonoDevelop debugger attached to the editor, it does not have the same problem. It connects instantly just like the stand-alone .exe does.

What would the editor be doing differently when the debugger is not attached which would prevent the receiving of network packets?