Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
TcpClient client = new TcpClient("somehost.com", portNum);
NetworkStream ns = client.GetStream();
// Write a single byte
ns.WriteByte(0x20);
// Write an ASCII string
byte[] MyBytes = Encoding.ASCII.GetBytes("blahblahblah");
ns.Write(MyBytes, 0, MyBytes.Length);
// Write a Unicode UTF-8 string
MyBytes = Encoding.UTF8.GetBytes("moreblahblahblah");
ns.Write(MyBytes, 0, MyBytes.Length);
// Read a byte
int NumBytesRead = ns.ReadByte();
If (NumBytesRead == -1) {
return; // at end of stream
}
// Read an ASCII string
MyBytes = new Byte[8192]; // create buffer
NumBytesRead = ns.Read(MyBytes, 0, MyBytes.Length);
If (NumBytesRead == -1) {
return; // at end of stream
}
Console.WriteLine(Encoding.ASCII.GetString(MyBytes, 0, MyBytes.Length);
// Read a Unicode UTF8 string
MyBytes = new Byte[8192]; // create buffer
NumBytesRead = ns.Read(MyBytes, 0, MyBytes.Length);
If (NumBytesRead == -1) {
return; // at end of stream
}
Console.WriteLine(Encoding.UTF8.GetString(MyBytes, 0, MyBytes.Length);
client.Close();