A
A Hirsi
I have created a vb .net program as a service that is using a simple
ftpclient to connect to a remote server and check the status of a file
for subsequent downloading if there have been changes to it.
I have been having many problems and need your help.
1. When I use a thread to start the service it only runs once
and quits. I do not see any of my eventlog.writelog entries again.
2. I used a timer that fires off every 10 seconds (for testing
purposes).
However this generates the following error on the 10th run:
"Unable to read data from the transport connection. --->
System.Net.Sockets.SocketException: An established connection was
aborted
by the software in your host machine"
3. I am running windows 2000 professional and using my local 127.0.0.1
ftp site
for testing.
4. The method startprocess logs into the ftp server on each call. Is
there
a better way to handle this? How do I get the details of the file
without
logging in again and again?
Here is my code snippet. If you need more code please let me know:
Protected Overrides Sub OnStart(ByVal args() As String)
Try
tMonitor = New Thread(AddressOf clsMonitor.StartProcess)
tMonitor.Start()
Catch ex As Exception
EventLog.WriteEntry("monitorftp->onstart", ex.ToString)
End Try
End sub
Please note that the method clsMonitor.StartProcess calls an FTP
Client to log into the remote site.
Here is the error in detail after the service runs about 10 times.
System.IO.IOException: Unable to read data from the transport
connection. ---> System.Net.Sockets.SocketException: An established
connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
at System.IO.Stream.ReadByte()
at FtpClient.GetResponse() in D:\FTPMain.vb:line 210
at FtpClient.Send(String message) in D:\FTPMain.vb:line 197
at FtpClient.Connect(String serverName, String userName, String
password) in D:\FTPMain.vb:line 63
at FTPMain.FTPConnect(String serverName, String userName, String
password, String remoteFileName, String localFileName) in
D:\FTPMain.vb:line 245
What am I doing wrong? Please help.
Thanks.
Hirsi
ftpclient to connect to a remote server and check the status of a file
for subsequent downloading if there have been changes to it.
I have been having many problems and need your help.
1. When I use a thread to start the service it only runs once
and quits. I do not see any of my eventlog.writelog entries again.
2. I used a timer that fires off every 10 seconds (for testing
purposes).
However this generates the following error on the 10th run:
"Unable to read data from the transport connection. --->
System.Net.Sockets.SocketException: An established connection was
aborted
by the software in your host machine"
3. I am running windows 2000 professional and using my local 127.0.0.1
ftp site
for testing.
4. The method startprocess logs into the ftp server on each call. Is
there
a better way to handle this? How do I get the details of the file
without
logging in again and again?
Here is my code snippet. If you need more code please let me know:
Protected Overrides Sub OnStart(ByVal args() As String)
Try
tMonitor = New Thread(AddressOf clsMonitor.StartProcess)
tMonitor.Start()
Catch ex As Exception
EventLog.WriteEntry("monitorftp->onstart", ex.ToString)
End Try
End sub
Please note that the method clsMonitor.StartProcess calls an FTP
Client to log into the remote site.
Here is the error in detail after the service runs about 10 times.
System.IO.IOException: Unable to read data from the transport
connection. ---> System.Net.Sockets.SocketException: An established
connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset,
Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32
offset, Int32 size)
at System.IO.Stream.ReadByte()
at FtpClient.GetResponse() in D:\FTPMain.vb:line 210
at FtpClient.Send(String message) in D:\FTPMain.vb:line 197
at FtpClient.Connect(String serverName, String userName, String
password) in D:\FTPMain.vb:line 63
at FTPMain.FTPConnect(String serverName, String userName, String
password, String remoteFileName, String localFileName) in
D:\FTPMain.vb:line 245
What am I doing wrong? Please help.
Thanks.
Hirsi