Hello, i'm sending a file using tcpListener, It was all going great until i sent a 3MB file, this is basically the code i use
public frmPrincipal()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
}
private void btnEnviar_Click(object sender, EventArgs e)
{
TcpClient clienteTCP = new TcpClient(AddressFamily.InterNetwork);
IPAddress[] listaHost = Dns.GetHostAddresses("xxx.xxx.xxx.xxx");
clienteTCP.BeginConnect(listaHost, 3000, new AsyncCallback(IniciarConexion), clienteTCP);
}
public void IniciarConexion(IAsyncResult piasResultado)
{
TcpClient cliente = piasResultado.AsyncState as TcpClient;
using (NetworkStream clienteStream = cliente.GetStream())
{
ASCIIEncoding encoder = new ASCIIEncoding();
string arch = "song.mp3";
byte[] nombre = encoder.GetBytes(arch);
byte[] ArregloDeArchivo = File.ReadAllBytes(@"C:\Users\Hector\Desktop\" + arch);
clienteStream.Write(jeje, 0, jeje.Length);
clienteStream.Flush();
...
When i write it sends the file. But, when it is received, the size of the file is 8KB, why this happens ??? =(