зеркало из https://github.com/mono/mail-archives.git
150 строки
5.9 KiB
HTML
150 строки
5.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-osx] FtpWebRequest "Not connected"
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20FtpWebRequest%20%22Not%20connected%22&In-Reply-To=">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="004028.html">
|
|
<LINK REL="Next" HREF="004074.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-osx] FtpWebRequest "Not connected"</H1>
|
|
<B>chromex</B>
|
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20FtpWebRequest%20%22Not%20connected%22&In-Reply-To="
|
|
TITLE="[Mono-osx] FtpWebRequest "Not connected"">loren.hoffman at gmail.com
|
|
</A><BR>
|
|
<I>Tue Feb 15 17:58:56 EST 2011</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="004028.html">[Mono-osx] CoreMidi Design
|
|
</A></li>
|
|
<LI>Next message: <A HREF="004074.html">[Mono-osx] FtpWebRequest "Not connected"
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4053">[ date ]</a>
|
|
<a href="thread.html#4053">[ thread ]</a>
|
|
<a href="subject.html#4053">[ subject ]</a>
|
|
<a href="author.html#4053">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
Hello,
|
|
|
|
I am porting a device management application from Windows to OSX and am
|
|
having problems with the FtpWebRequest system. I distilled an example of the
|
|
issue down to the code sample below. When run in OSX an exception is thrown
|
|
stating "Not connected". This is odd because if I put in the wrong
|
|
credentials then it gives the error: "Server returned an error: 530 Login
|
|
incorrect" which implies that it the "Not connected" error is happening
|
|
after a successful authentication. Besides this example being taken from
|
|
code that works in Windows it also correlates with all examples I have found
|
|
regarding FtpWebRequest. I have even checked that the final FtpWebRequest
|
|
fields match in Visual Studio and in Monodevelop right before the
|
|
GetResponse method is called; all do except for the Proxy property which
|
|
appears to be implemented slightly differently. Finally, I tried running the
|
|
code against multiple ftp servers including the target device and the built
|
|
in OSX ftp server, all with the same results.
|
|
|
|
It is possible I have a simple issue I am overlooking or there is some
|
|
aspect of it that requires extra care in OSX. If anyone has any input on
|
|
this or can confirm the issue on other systems that would help a lot. If any
|
|
other information is needed outside what I have already provided please let
|
|
me know.
|
|
|
|
Cheers,
|
|
- Loren
|
|
|
|
/////
|
|
// Example
|
|
|
|
using System;
|
|
using System.Net;
|
|
using System.IO;
|
|
|
|
namespace TestFTP
|
|
{
|
|
class MainClass
|
|
{
|
|
public static void Main (string[] args)
|
|
{
|
|
Console.WriteLine ("Starting test...");
|
|
|
|
FtpWebRequest req = (FtpWebRequest)FtpWebRequest.Create(new
|
|
Uri("<A HREF="ftp://192.168.10.117/"">ftp://192.168.10.117/"</A>));
|
|
|
|
req.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
|
|
req.UseBinary = false;
|
|
req.KeepAlive = false;
|
|
req.UsePassive = false;
|
|
req.Credentials = new NetworkCredential("admin", "admin");
|
|
try
|
|
{
|
|
FtpWebResponse response = (FtpWebResponse)req.GetResponse();
|
|
StreamReader reader = new StreamReader(response.GetResponseStream());
|
|
Console.WriteLine(reader.ReadToEnd());
|
|
reader.Close();
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
Console.WriteLine("Error: ");
|
|
Console.WriteLine(e.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/////
|
|
// Run Output
|
|
|
|
cd "/Users/chromex/Projects/TestFTP/TestFTP/bin/Debug";
|
|
PKG_CONFIG_PATH="/Applications/MonoDevelop.app/Contents/MacOS/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/2.6.7/share/pkgconfig:/Library/Frameworks/Mono.framework/Versions/2.6.7/lib/pkgconfig"
|
|
PKG_CONFIG_LIBDIR=""
|
|
PATH="/Library/Frameworks/Mono.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
/Library/Frameworks/Mono.framework/Versions/2.6.7/bin/mono --debug
|
|
"/Users/chromex/Projects/TestFTP/TestFTP/bin/Debug/TestFTP.exe" ; echo; read
|
|
-p 'Press any key to continue...' -n1; exit
|
|
Loren-Hoffmans-MacBook-Pro:~ chromex$ cd
|
|
"/Users/chromex/Projects/TestFTP/TestFTP/bin/Debug";
|
|
PKG_CONFIG_PATH="/Applications/MonoDevelop.app/Contents/MacOS/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/2.6.7/share/pkgconfig:/Library/Frameworks/Mono.framework/Versions/2.6.7/lib/pkgconfig"
|
|
PKG_CONFIG_LIBDIR=""
|
|
PATH="/Library/Frameworks/Mono.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
/Library/Frameworks/Mono.framework/Versions/2.6.7/bin/mono --debug
|
|
"/Users/chromex/Projects/TestFTP/TestFTP/bin/Debug/TestFTP.exe" ; echo; read
|
|
-p 'Press any key to continue...' -n1; exit
|
|
Starting test...
|
|
Error:
|
|
Not connected
|
|
|
|
--
|
|
View this message in context: <A HREF="http://mono.1490590.n4.nabble.com/FtpWebRequest-Not-connected-tp3307834p3307834.html">http://mono.1490590.n4.nabble.com/FtpWebRequest-Not-connected-tp3307834p3307834.html</A>
|
|
Sent from the Mono - OSX mailing list archive at Nabble.com.
|
|
</PRE>
|
|
|
|
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="004028.html">[Mono-osx] CoreMidi Design
|
|
</A></li>
|
|
<LI>Next message: <A HREF="004074.html">[Mono-osx] FtpWebRequest "Not connected"
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#4053">[ date ]</a>
|
|
<a href="thread.html#4053">[ thread ]</a>
|
|
<a href="subject.html#4053">[ subject ]</a>
|
|
<a href="author.html#4053">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
|
mailing list</a><br>
|
|
</body></html>
|