Hello,
I am getting the following exception when a file that is over 26 megs large
is half way transferred:
system.io.ioexception: Unable to read data
from the transport connection...
system.net.sockets.socketexception: Unknow error
(0X2746)
at system.net.sockets.socket.beginreceive[byte[] butter, int32
offset, int32 size, socketFlags socketflags, asynccallback,
callback, object state]
at system.net.sockets.socket.beginreceive[byte[] butter, int32
offset, int32 size, socketFlags socketflags, asynccallback,
callback, object state]
end of inner excetion stack trace
The exception is happening at line 9
1 Private Sub CopyData(ByVal FromStream As Stream, ByVal ToStream As
Stream)
2 Dim intBytesRead As Integer
3 Dim Counter As Integer = 0
4 Const intSize As Integer = 1024
5 Dim bytes(intSize) As Byte
6 intBytesRead = FromStream.Read(bytes, 0, bytes.Length)
7 While intBytesRead > 0
8 ToStream.Write(bytes, 0, intBytesRead)
9 intBytesRead = FromStream.Read(bytes, 0, bytes.Length)
10 End While
12 End Sub
The Call to the Sub is
GetRequest.Method = "POST"
System.IO.Directory.CreateDirectory(TransferFolder)
Dim Myfs As New FileStream(CompleteName, FileMode.Create)
CopyData(TheResponse.GetResponseStream(), Myfs)
Myfs.Seek(0, SeekOrigin.Begin)
Myfs.Close()
The code is very similar at the web page that is sending the datastream
The error code's description (found online is)
Winsock Error: The remote host was unable to deliver a previously sent
datagram and responded with a "Port Unreachable" ICMP packet. The
application should close the socket as it is no longer usable
How do I fix this problem?
Any Suggestions will be greatly appreciated.
Thanks,
Chuck