Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Win2003 IIS6 C# ASP.NET VB.NET , +
Dear Developer,
I am trying to request to Java Server Socket but they are unable to receive my data_string (data="ABC").
They receive with error....
" invalid stream header: 56455249"
my code is as below...
string url = "";
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
                string proxy = null;
                string data = "ABC";
                byte[] buffer = Encoding.UTF8.GetBytes(data);
                req.Method = "POST";
                req.ContentType = "application/x-www-form-urlencoded";
                req.ContentLength = buffer.Length;
                req.Proxy = new WebProxy(proxy, true);
                req.CookieContainer = new CookieContainer();
                Stream reqst = req.GetRequestStream(); // add form data to request stream 
                reqst.Write(buffer, 0, buffer.Length);
I require Stream obj to send data to server as string and not as byte. How to do so?
Thanks in advance.
Rajesh Katare
Posted 24-Jun-11 5:35am
Edited 24-Jun-11 5:58am
(no name)140.6K

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 7,203
1 OriginalGriff 5,587
2 Peter Leow 4,097
3 Mika Wendelius 2,850
4 CHill60 2,818

Advertise | Privacy | Mobile
Web03 | 2.8.150224.1 | Last Updated 24 Jun 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100