每当发送的文件超过600000以上都会有这个错误:一个在数据报套接字上发送的消息大于内部消息缓冲器或其他一些网络限制,或该用户用于接收数据报的缓冲器比数据报小
public static IPEndPoint ipp;
public static UdpClient uc;
public static FileStream fs;
public static Int32 pt;
private static void sf()
{
byte[] bytes = new byte[fs.Length+1];
fs.Read(bytes, 0, bytes.Length);
MessageBox.Show(uc.Available.ToString());
// uc.Available = 1000000;
//这个又不能设置我的是2005的visual studio
uc.Send(bytes,bytes.Length);
MessageBox.Show("发送到尾了");
}
public static void sendfile()
{
MessageBox.Show("开始连接");
ip1 = IPAddress.Parse("192.168.12.235");
pt = Int32.Parse("5050");
ipp = new IPEndPoint(ip1, pt);
uc = new UdpClient(Dns.GetHostByAddress(ip1).HostName, pt);
fs = new FileStream("D:\\mm\\MyJpeg.jpg", FileMode.Open, FileAccess.Read);
MessageBox.Show("现在发送");
if(sfi())
{
Thread.Sleep(2000);
sf();
uc.Close();
fs.Close();
}
}
//请高手帮帮忙,如何解决这个问题
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货