471,327 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

networking help 2

CODE
public static void web(Socket suck )
{
byte [] rbuffer =new byte[BUFSIZE+1];
byte [] sbuffer =new byte[BUFSIZE+1];
string str="<HTML><BODY><H1>nweb Web Server
Sorry:</H1></BODY></HTML>\r\n";
sbuffer=str//error can convet
suck.Receive(rbuffer);
suck.Send(sbuffer);//cant send data as only byte array can
be send

}
how can an string be converted to a byte array.
Even convert class is not useful
plz help

Dec 1 '05 #1
2 960
lucifer,

Check out the Encoding class in the System.Text namespace.
Specifically, you have to decide on which kind of encoding you wish to use.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"lucifer" <um**********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
CODE
public static void web(Socket suck )
{
byte [] rbuffer =new byte[BUFSIZE+1];
byte [] sbuffer =new byte[BUFSIZE+1];
string str="<HTML><BODY><H1>nweb Web Server
Sorry:</H1></BODY></HTML>\r\n";
sbuffer=str//error can convet
suck.Receive(rbuffer);
suck.Send(sbuffer);//cant send data as only byte array can
be send

}
how can an string be converted to a byte array.
Even convert class is not useful
plz help

Dec 1 '05 #2
thanks

Dec 1 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by hyperbob | last post: by
6 posts views Thread by James Egan | last post: by
7 posts views Thread by Brian Keogh | last post: by
46 posts views Thread by H.A. Sujith | last post: by
4 posts views Thread by Raj | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.