TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pramod Kumar Nandagiri
NA
484
0
Transfer large size of image file using udp
Sep 18 2009 2:50 AM
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
WindowsPicSend_Test
{
public
partial
class
Form1
:
Form
{
UdpClient
send, receive;
IPEndPoint
sendpt, receivept;
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender,
EventArgs
e)
{
//OpenFileDialog mydialog = new OpenFileDialog();
//if (mydialog.ShowDialog() == DialogResult.OK)
//{
//string path = mydialog.FileName;
string
path =
"c:\\3.jpg"
;
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(
"192.168.1.4"
), 3333);
send.Send(data, data.Length, sendpt);
send.Close();
//}
}
That is my code It is able to send the images up to 50kb but if image size is greaterthan 50kb it is giving error
The error is: Value was either too large or too small for an Int16(over flow exception was unhandled)
please help me on this i want to send images with size upto 200kb to 500kb
Reply
Answers (
3
)
code for total mouse click on desktop not on from in c#
how to set mouse focus on from in c#