using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Runtime.Serialization.Formatters.Binary;
namespace picturesend
{
public partial class Form1 : Form
{
UdpClient send, receive;
IPEndPoint sendpt, receivept;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(picsend));
t.IsBackground.CompareTo(true);
t.Start();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog mydialog = new OpenFileDialog();
if (mydialog.ShowDialog() == DialogResult.OK)
{
string path = mydialog.FileName;
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] data = br.ReadBytes(Convert.ToInt16(fs.Length));
send = new UdpClient();
sendpt=new IPEndPoint(IPAddress.Parse("127.0.0.1"),3333);
send.Send(data,data.Length,sendpt);
send.Close();
}
}
public void picsend()
{
receive = new UdpClient(3333);
do
{
try
{
byte[] pic = receive.Receive(ref receivept);
using (MemoryStream ms = new MemoryStream(pic, 0, pic.Length))
{
ms.Write(pic, 0, pic.Length);
Image im = Image.FromStream(ms, true);
pictureBox1.Image = im;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
} while (true);
}
}
}
Transfer large size of image file using udphow to transfer large image file using udp client
Page 1 of 1
6 Replies - 16680 Views - Last Post: 09 April 2009 - 02:38 PM
#1
Transfer large size of image file using udp
Posted 09 April 2009 - 11:25 AM
Hello i am able to transfer upto 50 kb of image file but when i trying to transfer more than that i m gettin an error....plz help me ...thanks
Replies To: Transfer large size of image file using udp
#2
Re: Transfer large size of image file using udp
Posted 09 April 2009 - 12:16 PM
Have you checked the maxRequestLength value in the web.config.
http://msdn.microsof...uestlength.aspx
http://msdn.microsof...uestlength.aspx
#3
Re: Transfer large size of image file using udp
Posted 09 April 2009 - 01:24 PM
webrich, on 9 Apr, 2009 - 11:16 AM, said:
Have you checked the maxRequestLength value in the web.config.
http://msdn.microsof...uestlength.aspx
http://msdn.microsof...uestlength.aspx
Quote
i didn't get any idea plz help me where is the problem
This post has been edited by abhivitmca: 09 April 2009 - 01:25 PM
#4
Re: Transfer large size of image file using udp
Posted 09 April 2009 - 01:30 PM
What is the error you're getting?
#6
Re: Transfer large size of image file using udp
Posted 09 April 2009 - 02:25 PM
abhivitmca, on 9 Apr, 2009 - 12:24 PM, said:
webrich, on 9 Apr, 2009 - 11:16 AM, said:
Have you checked the maxRequestLength value in the web.config.
http://msdn.microsof...uestlength.aspx
http://msdn.microsof...uestlength.aspx
Quote
i didn't get any idea plz help me where is the problem
Quote
i m gettin error following
A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
#7
Re: Transfer large size of image file using udp
Posted 09 April 2009 - 02:38 PM
PsychoCoder, on 9 Apr, 2009 - 12:30 PM, said:
What is the error you're getting?
Quote
i am getting an error following
A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|