i have a little Problem with my Netduino+ - TelnetServer. I using the Toolbox.NETMF.dll and the Toolbox.NETMF.NET.dll for the Telnetserver.
My Problem:
Always, when i try to turn a LED on off (over Telnet) then i become bytes-errors:
Eine Ausnahme (erste Chance) des Typs "System.Net.Sockets.SocketException" ist in Microsoft.SPOT.Net.dll aufgetreten.
Failed allocation for 136 blocks, 1632 bytes
or:
Eine Ausnahme (erste Chance) des Typs "System.Net.Sockets.SocketException" ist in Microsoft.SPOT.Net.dll aufgetreten.
Failed allocation for 116 blocks, 1392 bytes
Always these errors. But only, when i use my Telnet-Control Program. When i use CMD>Telnet, then it works without problem, but i need a GUI.
Here is my LED_Test.vb from the netduino-server:
Imports System Imports Microsoft.SPOT Imports Microsoft.SPOT.Hardware Imports Toolbox.NETMF Imports Toolbox.NETMF.NET Imports Microsoft.VisualBasic Imports SecretLabs.NETMF.Hardware.NetduinoPlus Namespace Programs Public Module LED_Test Dim led1 As OutputPort = New OutputPort(Pins.GPIO_PIN_D0, False) Dim led2 As OutputPort = New OutputPort(Pins.GPIO_PIN_D2, False) Dim led3 As OutputPort = New OutputPort(Pins.GPIO_PIN_D4, False) Public Sub Bind(ByVal Shell As ShellCore) AddHandler Shell.Empfangen, AddressOf Shell_OnCommandReceived End Sub Public Sub Unbind(ByVal Shell As ShellCore) RemoveHandler Shell.Empfangen, AddressOf Shell_OnCommandReceived End Sub Public Sub Shell_OnCommandReceived(ByVal Shell As ShellCore, ByVal Arguments() As String, ByRef SuspressError As Boolean, ByVal Time As DateTime) Dim command As String = Arguments(0).ToUpper() Dim lol As String = command Debug.Print(command & "|" & lol) If lol.Substring(0, 3) = "LED" Then LED_Test.Start(command, Shell.Telnetserver) SuspressError = True ElseIf command = "HELP" Then If Arguments.Length = 1 Then Shell.Telnetserver.Print("LED[NUMMER]=[1/0] Interactive Output Demo") SuspressError = True Else : End If End If End Sub Public Sub Start(ByVal command As String, ByVal Server As TelnetServer) command = command.Substring(3) Debug.Print(command) Dim status As String() = command.Split("=") Dim Output As String = status(0) Dim on_off As String = status(1) Debug.Print(Output) Debug.Print(on_off) Select Case Output Case "1" If on_off = "1" Then led1.Write(True) Server.Print("LED1=1") ElseIf on_off = "0" Then led1.Write(False) Server.Print("LED1=0") Else : End If Case "2" If on_off = "1" Then led2.Write(True) Server.Print("LED2=1") ElseIf on_off = "0" Then led2.Write(False) Server.Print("LED2=0") Else : End If Case "3" If on_off = "1" Then led3.Write(True) Server.Print("LED3=1") ElseIf on_off = "0" Then led3.Write(False) Server.Print("LED3=0") Else : End If End Select End Sub End Module End Namespace
And Here a little Piece of my "SEND-Class" of my Telnet-Client:
Public Sub Senden(ByVal text As String) Dim SendBytes As [Byte]() = Encoding.ASCII.GetBytes(text & vbCrLf) tnSocket.Send(SendBytes, SendBytes.Length, SocketFlags.None) End SubAnd the listen-code
Public Sub Listen() Dim NumBytes As Integer = 0 Dim RecvBytes(511) As [Byte] Do While tnSocket.Connected = True Do NumBytes = tnSocket.Receive(RecvBytes, RecvBytes.Length, 0) RecvString = RecvString + Encoding.ASCII.GetString(RecvBytes, 0, NumBytes) Loop While NumBytes = 512 'RichTextBox1.Text = RecvString & vbCrLf Me.Invoke(New DAddItem(AddressOf AddItem), RecvString) Me.Invoke(New DAddItem(AddressOf Steuerung), RecvString) Debug.Print("listening") Wait(1000) Loop Debug.Print("Connection lost") End Sub
I just tried to find the error, but i dont understand it
need little help please
thx & mfg
gfcwfzkm
EDIT\> im not sure, but i think, that the error come allways, when im under 20kB Free RAM.
When i disconnect me, the program take allways ~0.5kB RAM. How i can fix that?