All pastes #586205 Raw Edit

Anonymous

public text v1 · immutable
#586205 ·published 2007-06-23 18:17 UTC
rendered paste body
byte[] bbuffer = new byte[sock.ReceiveBufferSize];

            sock.Receive(bbuffer);
            textBox1.Text += ("Reply received...\r\n");

            MemoryStream mstream;

            char[] reply = Encoding.ASCII.GetChars(bbuffer);
            string replystr = new string(reply);

            Regex rg = new Regex("\\r\\n\\r\\n");
            MatchCollection mc = rg.Matches(replystr);
            int i = 0;
            foreach (Match m in mc)
            {
                i = m.Index;
            }

            mstream = new MemoryStream(bbuffer);
            sock.Disconnect(false);
            return Image.FromStream(mstream);