networkstream always empty!
        Posted  
        
            by ALEX
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ALEX
        
        
        
        Published on 2010-03-24T13:22:38Z
        Indexed on 
            2010/03/24
            13:33 UTC
        
        
        Read the original article
        Hit count: 211
        
c#
|networking
hey I'm writing on an Server-Client program but when my client sends something, it never reaches my server!
I'm sending like this:
    public void Send(string s)  
    {  
        char[] chars = s.ToCharArray();  
        byte[] bytes = chars.CharToByte();  
        nstream.Write(bytes, 0, bytes.Length);  
        nstream.Flush();  
    }
and Receiving in a background thread like this
    void CheckIncoming(object dd)
    {
        RecievedDelegate d = (RecievedDelegate)dd;
        try
        {
            while (true)
            {
                List<byte> bytelist = new List<byte>();
                System.Threading.Thread.Sleep(1000);
                int ssss;
                ssss = nstream.ReadByte();
                if (ssss > 1)
                {
                    System.Diagnostics.Debugger.Break();
                }
                if (bytelist.Count != 0)
                {
                    d.Invoke(bytelist.ToArray());
                }
            }
        }
        catch (Exception exp)
        {
            MSGBOX("ERROR:\n" + exp.Message);
        }
    }
the ssss int is never > 1 whats happening here???
© Stack Overflow or respective owner