client stream is null at client connected

May 18, 2012 at 9:44 AM

Hi

I am testing your library

I want to send some data to server (from client) as soon as client is able to connect to the server.

The problem is that, client has no stream allocated at that moment. How to find when the stream is allocated and when to initiate contact with server;

 void client_OnConnected(object sender, NetConnectedEventArgs e)
        {
            write("Client connected");
            Invoke(new Action(delegate
            {
               // ((NetClient)sender).Send(Encoding.ASCII.GetBytes("TEST"));
                //client.Send(Encoding.ASCII.GetBytes("TEST"));
            }));
        }

At the commented places, if you watch the client object, its stream is null.

How to resolve it?

Best Regards

Ajay