problems with System.Net.TcpClient

  • Thread starter Thread starter DM
  • Start date Start date
D

DM

Hello.


I have an odd problem with sending date through
tcp connection. Whenever I send sth only first 8192 bytes
pass through.

Here is how I do it:

server:

byte[] tb=new byte[12000];

for (int i=0;i<tb.Length;i++)
tb=1;

TcpListener list=new TcpListener("127.0.0.1",8899);

list.Start();

TcpClient tcpc=list.Accept();

BinaryWriter bw=new BinaryWriter(tcpc.GetStream());

bw.Write(tb);

bw.Close();




client:

byte[] tb=new byte[12000];

TcpClient tcpc=new TcpClient("127.0.0.1",8899);

BinaryReader br= new BinaryReader(tcpc.GetSteram());

br.Read(tb,0,tb.Length);


Only elements of 0-8191 are 1s the remaining ones
are 0s.

I would be grateful for any help.
 
How many bytes were actually received? You did nothing with the Read()
return value.

Paul T.
 
Back
Top