[C# help] NetworkStream byte size
I need help on the size of the byte I get here is the error code and error image
Quote:
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.IO;
using Microsoft.VisualBasic;
using System.Data;
using System.Diagnostics;
using System.Collections;
class MainClass
{
public static void Main()
{
TcpListener client = new TcpListener(1234);
client.Start();
while (true)
{
while (!client.Pending())
{
Thread.Sleep(1000);
}
ConnectionThread newconnection = new ConnectionThread(client);
}
}
}
class ConnectionThread
{
public TcpListener threadListener;
public ConnectionThread(TcpListener lis)
{
threadListener = lis;
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleConnection));
}
public void HandleConnection(object state)
{
TcpClient client = threadListener.AcceptTcpClient();
NetworkStream ns = client.GetStream();
byte[] bytes = new byte[client.ReceiveBufferSize];
//byte[] bytes = new byte[255];
int count;
String data = "";
do
{
count = ns.Read(bytes, 0, client.ReceiveBufferSize);
data = System.Text.Encoding.ASCII.GetString(bytes, 0, count);
if (data != "exit\n")
{
Byte[] Bytes = bytes;
string hex = BitConverter.ToString(Bytes);
hex = hex.Replace("-", "");
Console.Write("\nC->: hex {0}", hex);
if (hex == "1300006319A0D4DAAEB944CBE8C8B23F36673F130000297FB5DF5F3704393A30AAC0B0E5FBE2000000000000000000000000")
{
byte[] datax = new byte[1024];
datax = new byte[] { 0x43, 0x41, 0x52, 0x4C, 0x4F, 0x53, 0x58 };
ns.Write(datax, 0, datax.Length);
Console.Write("\nCliente Online: 1");
return;
}
}
} while (data != "exit\n");
}
}
http://img515.imageshack.us/img515/2285/errorsuo.jpg
Re: [C# help] NetworkStream byte size
Wrong section.
Belongs in the coding section, not the showcase section.
Re: [C# help] NetworkStream byte size
sorry if someone can move me confused with the announcement