I am writing an application that gets its data from many small servers (the "servers" are data loggers and the app consumes the data from the loggers). The data exists as files on the server and I have been using SSH FTP to get the files. Specifically I'm using the .NET wrapper for WinSCP
I have had some problems with this, some transfer fail (while Filezilla succeeds) and it does not report progress. Also, the downloads can be long due to limited bandwidth at the server. So I would like to use BITS to do the transfers but it appears this only works with HTTP. I could switch to HTTP but I currently check what needs to be downloaded by comparing file sizes and dates on the server and the local cache. This does not seem possible using HTTP.
Is there a way to use BITS and FTP? Or is there a way to check what needs downloading with HTTP?
I have complete control over the servers. They currently run Linux and OpenSSH to facilitate the transfers. I'm using VB and .NET framework 4.0 for the application.
Thanks.
You can use a System.Net.HttpWebRequest to the web URL with a request method of "HEAD". You can then get a System.Net.HttpWebResponse and check the ContentLength and LastModified properties of the response to compare to the local cache.
e.g.
dim request as System.Net.HttpWebRequest
request=System.Net.HttpWebRequest.Create("http://...")
request.Method="HEAD"
dim response as System.Net.HttpWebResponse=request.GetResponse
dim fileLength as integer=response.ContentLength
dim fileDate as datetime=response.LastModified
obviously, you need to trap for exceptions as the GetResponse might not like it if the file isn't there or the server isn't available, etc.
Hope this helps, Regards, Denver
Related
Created a carbon app using WSO2 ei611 using Inbound-endpoint-file.deployed
on WSO2.
Works good for local files.
When given FTP url
(ftp://username:password#servername/folder1/folder2/folder3), throws warn-
error WARN FilePollingConsumer Unable to access or read file or directory : username":#"servername/folder1/folder2/folder3. Reason: The file does not exists!
Used hexadecimal password in the url(as password had spl chars), still did
not work.
I changed all FTP folders/subfolders to 'chmod 777', still no luck.
I know, EI611 use apache-commons-ftp. The error string, is used in this library.
I then downloaded apache-commons-net-3.6 and used the same library and ran
a FTP client java from WSO2 server machine , and it works fine , in
connecting to FTP server, using java.
So, where's the problem? Hello, WSO2? care to answer?
adding vfs.passive=true did the magic. Thanks for the tip. I did saw this paramter earlier while developing, but ignored it, thinking, it is of no value.
I am using Windows Explorer to test the WebDAV implementation I am adapting to our system. The implementation is using IIS Express and is launched by Visual Studio 2013. I turned off Windows Explorer's requirement for SSL with WebDAV so I can test basic authentication (which works).
The problem I am having is with the Write method of the DavFile implementation. I connect to the web folder, navigate to a sub folder, then attempt to copy a JPG file from a folder on my computer's hard drive, into the WebDAV sub folder (using Windows Explorer).
The attempt to copy up a file (854kb) fails. When I set a break point, I notice that the "segment" stream (one of the input parameters on the "write" method, shows 0 (zero) bytes length.
Any tips on how to debug this problem? What is the most likely cause of 0 byte in the stream?
Here are some ideas about how to understand what is going wrong:
Examine the server log for exceptions. By default it is called WebDAVLog.txt and located in \App_Data\WebDAV\Logs\ folder. Are there any exceptions in it? Check your server log and make sure all requests were successful.
Examine WebDAV requests with a Fiddler tool or any other debugging proxy. While all requests that reached the WebDAV server Engine are logged, if the request failed before hitting the Engine you will not see it in a log. Usually this happens if the request failed during authentication stage.
Note that to capture requests using Fiddler on 'localhost' you must use 'localhost.fiddler' instead of 'localhost' when connecting to server, for example: http://localhost.fiddler:1234.
Exclude any client side issues. Finally there could be issues with client software that you are using, including with Microsoft miniredirector. Try to access server from any other machine. To get the idea if the problem is on the client or server side try also to reproduce the issue on ajaxbrowser.com.
You can post a part of the WebDAVLog.txt or fiddler log here or send it to IT Hit, it may give the idea of what is wrong.
I want to start a simple process that can be in activiti-explorer or I deployed,using activiti-rest api. I use SoapUI or RESTClient.Actually I wrote URL and I can see all of the process,after I start the process with rest-services, I can see the process started in SoapUI,becasuse the reponse is true,but in activiti-explorer,process isn t starting.What should I do? I m waiting your helps
Thanks
My guess is that you deployed the activiti-webapp-explorer2 and activiti-webapp-rest as separate war files and each is using an in memory database.
This means, the applications are essentially seperate.
You have two choices.
Deploy as separate webapps but set them to use the same database instance/
Merge the rest API jar into the explorer webapp.
Both methods are acceptable.
I am using apache.net.ftp api to download from and upload to ftp server. Its working fine in normal scenarios.
But the issue starts when there is some latency or connection is closed by the server for some reasons.
Here comes the time-out. I found a parameter 'SO_TIMEOUT' which is considered when reading from socket. So, I used ftpClient.setSoTimeout(time in millis) method to set it which will be used while downloading a file. It worked fine.
I am not getting how to set time-out while uploading the file to the ftp-server.
Thanks in advance.
Check the following things to make sure everything is running fine,and then try again::
Check the Firewall setting,if any which might be blocking the incoming connections and the connection timeout.
I'm Trying to write a plugin for NotePad++ using NppScripting - a platform for writing plugins using javascript (specifically - JScript).
I was wondering if there was a way (probably via ActiveXObject) with which I could listen to a port asynchronously (specifically - I'm trying to write a CSS-X-Fire port to NPP).
I know .NET has that capability via System.Net.Sockets but I couldn't figure out a way to access it via JScript.
Any help?
If I were doing this, I would write the Socket server in .NET as a standalone EXE.
If I understand CSS-X-Fire correctly, it is a plugin to IntelliJ Idea that listens to outgoing communications from Firebug, and then updates source files appropriately. It sounds relatively simple. The .NET socket server could do this very easily.
Then, rather than expose a 2nd interface directly from the socket server to the scripting environment - like a COM object or a COPYDATA channel or something like that - I'd use the filesystem for communication. In other words, script something in NPP that polls the filesystem file for updates. When the .NET Socket server gets a message that says "Firebug just updated file X.css", the .NET Socket server can apply those updates to the filesystem file, and save changes back to the filesystem. Because the Notepad++ app polls the filesystem, it will see the updated file and reload it, picking up those saved changes. You'd need to do cursor management within N++ intelligently.
Emacs has an "auto revert mode" for this sort of thing, so the .NET CSS-X-Fire Socket server would work with emacs out of the box - no additional scripting required. Not sure if N++ has an auto-revert equivalent.
I eventually decided to use Adobe AIR to create my solution. It provides an amazing set of APIs, including a set of Socket APIs.
You can look at my solution here