<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>James's Feed - Programmer's Heaven</title>
    <link>http://www.programmersheaven.com/feed/User/8830/RSS.aspx</link>
    <description>Events at Programmer's Heaven related to the user James.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Thu, 20 Jun 2013 03:18:50 -0700</pubDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <item>
      <title>ftp response timeout</title>
      <link>http://www.programmersheaven.com/mb/VBNET/420737/420737/ReadMessage.aspx#420737</link>
      <description>&lt;p&gt;Posted a '&lt;a href="http://www.programmersheaven.com/mb/VBNET/420737/420737/ReadMessage.aspx#420737"&gt;new message&lt;/a&gt; on the &lt;a href="http://www.programmersheaven.com/mb/VBNET/Board.aspx"&gt;VB.NET&lt;/a&gt; forum.&lt;/p&gt;Hi all,&lt;br /&gt;
I have a Windows Service that uses ftp to query a folder on a remote server and download any files it finds there, deleting them afterward. It has been running without issue for well over a year until three weeks ago.&lt;br /&gt;
&lt;br /&gt;
Now there is an intermittent error. Periodically when it sends a port command, it hangs waiting for a response from the remote server.  According to the admin at the remote server, the command simply never arrives.&lt;br /&gt;
&lt;br /&gt;
This is legacy code from VB.Net 2003 recompiled in VS 2005.  Any help or ideas will be greatly appreciated.&lt;br /&gt;
&lt;br /&gt;
-James&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
    Public Overloads Function DownloadFile(ByVal RemoteFile As String, ByVal LocalFile As String, ByVal StreamMode As StreamModes, ByVal FileMode As DataConnection.FileModes, ByVal AppendFrom As Long) As Boolean
        SendCommand("TYPE " + Convert.ToChar(StreamMode))
        If Not CreateDataSocket(LocalFile, FileMode, DataConnection.StreamDirections.Download, AppendFrom) Then
            RaiseEvent CommandCompleted()
            Return False
        End If
        If Not (passiveTransfers) Then
            Dim MyEndPoint As IPEndPoint = dataSocket.GetLocalEndPoint()
            SendCommand("PORT " + MyEndPoint.Address.ToString.Replace(".", ",") + "," + CType(Math.Floor(MyEndPoint.Port / 256), Integer).ToString + "," + (MyEndPoint.Port Mod 256).ToString)
        End If
        If FileMode = DataConnection.FileModes.Append AndAlso AppendFrom &amp;gt; 0 Then
            SendCommand("REST " + AppendFrom.ToString)
        End If
        SendCommand("RETR " + RemoteFile)
        If lastResponseType &amp;lt;&amp;gt; 4 AndAlso lastResponseType &amp;lt;&amp;gt; 5 Then
            Try
                dataSocket.ReceiveFromSocket()
            Catch EX As Exception
                dataSocket.Close()
                WaitForResponse()
                RaiseEvent CommandCompleted()
                Return False
            End Try
            WaitForResponse()
        End If
        dataSocket.Close()
        RaiseEvent CommandCompleted()
        Return True
    End Function

Private Sub SendCommand(Command as String)
	Try
		clientSocket.Send(ASCII.GetBytes(Command + Convert.ToChar(13) + Convert.ToChar(10)))'ControlChars.CrLf))
		If Command.Length &amp;gt;= 4 AndAlso Command.SubString(0, 4).ToUpper.Equals("PASS") Then
	RaiseEvent CommandSent("PASS ********")
	Else
				RaiseEvent CommandSent(Command)
			End If
			WaitForResponse()
        Catch EX As Exception
            RaiseEvent ConnectionFailed()
            lastResponseNumber = 0
            lastResponseType = 0
            lastResponse = ""
            Throw EX
        End Try
	End Sub

	Private Sub WaitForResponse()
		If Not(isNowConnected) Then Exit Sub
		Dim tempBuffer(1023) as Byte
		Dim retBytes as Integer
		Dim retString as String = ""
		Do
			Try
				retBytes = clientSocket.Receive(tempBuffer)
            Catch EX As Exception
                WriteToMyEventLog(EX.Message &amp;amp; vbCrLf &amp;amp; EX.StackTrace, , EventLogEntryType.Error)
                'Throw EX
                Exit Do
            End Try
            retString = retString + ASCII.GetString(tempBuffer, 0, retBytes)
        Loop Until IsValidResponse(retString)
		lastResponse = retString
		If retString.Length &amp;gt;= 3 Then
			lastResponseNumber = Short.Parse(retString.Substring(0, 3))
		Else
			lastResponseNumber = 0
		End If
		lastResponseType = CType(Math.Floor(lastResponseNumber / 100), Short)
		RaiseEvent ReceivedReply(lastResponse, lastResponseNumber, lastResponseType)
	End Sub
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/VBNET/420737/420737/ReadMessage.aspx#420737</guid>
      <pubDate>Tue, 04 Jan 2011 14:31:57 -0700</pubDate>
    </item>
    <item>
      <title>Re: NVarChar data type</title>
      <link>http://www.programmersheaven.com/mb/TheOne/409024/414881/ReadMessage.aspx#414881</link>
      <description>&lt;p&gt;Posted a '&lt;a href="http://www.programmersheaven.com/mb/TheOne/409024/414881/ReadMessage.aspx#414881"&gt;reply&lt;/a&gt; on the &lt;a href="http://www.programmersheaven.com/mb/TheOne/Board.aspx"&gt;Advanced VB.Net&lt;/a&gt; forum.&lt;/p&gt;Have you tried explicitly specifying the max in your parameter declaration? &lt;br /&gt;
&lt;br /&gt;
 @Body nvarchar(4000)&lt;br /&gt;
&lt;br /&gt;
I had an issue with this datatype being declared as "MAX" because of a legacy issue.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/TheOne/409024/414881/ReadMessage.aspx#414881</guid>
      <pubDate>Thu, 25 Mar 2010 13:51:45 -0700</pubDate>
    </item>
    <item>
      <title>Re: Can't get Immedite WIndow in VB.2005</title>
      <link>http://www.programmersheaven.com/mb/TheOne/414684/414880/ReadMessage.aspx#414880</link>
      <description>&lt;p&gt;Posted a '&lt;a href="http://www.programmersheaven.com/mb/TheOne/414684/414880/ReadMessage.aspx#414880"&gt;reply&lt;/a&gt; on the &lt;a href="http://www.programmersheaven.com/mb/TheOne/Board.aspx"&gt;Advanced VB.Net&lt;/a&gt; forum.&lt;/p&gt;Well, it came back.  I now have the Immediate window, but I don't know why.  There was a reboot in there somewhere, but now it's fixed, so... Nevermind.&lt;br /&gt;
&lt;br /&gt;
-james</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/TheOne/414684/414880/ReadMessage.aspx#414880</guid>
      <pubDate>Thu, 25 Mar 2010 13:43:46 -0700</pubDate>
    </item>
    <item>
      <title>Can't get Immedite WIndow in VB.2005</title>
      <link>http://www.programmersheaven.com/mb/TheOne/414684/414684/ReadMessage.aspx#414684</link>
      <description>&lt;p&gt;Posted a '&lt;a href="http://www.programmersheaven.com/mb/TheOne/414684/414684/ReadMessage.aspx#414684"&gt;new message&lt;/a&gt; on the &lt;a href="http://www.programmersheaven.com/mb/TheOne/Board.aspx"&gt;Advanced VB.Net&lt;/a&gt; forum.&lt;/p&gt;I just inherited a project and workstation used to support a large asp.net application. I started it up in debug mode and put a break on a code line. When it breaks, I can't seem to produce the Immediate window. If you select Debug-&amp;gt;windows the Immediate window is not listed. Locals, autos, etc are listed, but not my old reliable.&lt;br /&gt;
&lt;br /&gt;
This is vs 2005. &lt;br /&gt;
&lt;br /&gt;
Any ideas?&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
&lt;br /&gt;
James</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/TheOne/414684/414684/ReadMessage.aspx#414684</guid>
      <pubDate>Thu, 18 Mar 2010 08:56:32 -0700</pubDate>
    </item>
  </channel>
</rss>