[erlang-questions] OTP.NET Error

Serge Aleynikov saleyn@REDACTED
Sat Oct 4 04:38:24 CEST 2008


I took a quick look at your code and see that you are doing this on 
every button click which is wrong:

         OtpSelf self = new OtpSelf("client@REDACTED", "abc123");
         OtpPeer server = new OtpPeer("server@REDACTED");
         OtpConnection connection = server.connect(self);

Move that to form initialization function, and try again.  I guess 
what's going on is that OtpAbstractNode doesn't implement proper 
destruction and freeing resources (the socket connection), and as a 
result on every button click you are trying to set up more than one 
connection with the Erlang server node, which is not allowed, so the 
server drops the second and following connection attempts.

Serge


Matt Williamson wrote:
> I'm trying out a simple OTP.NET test and it works great for the first call,
> but any subsequent calls result in the following exception:
> System.IO.IOException was unhandled
>   Message="Peer replied with status 'alive' instead of 'ok'"
>   Source="Otp"
>   StackTrace:
>        at Otp.AbstractConnection.recvStatus() in C:\Documents and
> Settings\Administrator\Desktop\jungerl\lib\otp.net\Otp\AbstractConnection.cs:line
> 1455
>        at Otp.AbstractConnection.doConnect(Int32 port) in C:\Documents and
> Settings\Administrator\Desktop\jungerl\lib\otp.net\Otp\AbstractConnection.cs:line
> 1018
>        at Otp.AbstractConnection..ctor(OtpLocalNode self, OtpPeer other) in
> C:\Documents and
> Settings\Administrator\Desktop\jungerl\lib\otp.net\Otp\AbstractConnection.cs:line
> 226
>        at Otp.OtpConnection..ctor(OtpSelf self, OtpPeer other) in
> C:\Documents and
> Settings\Administrator\Desktop\jungerl\lib\otp.net\Otp\OtpConnection.cs:line
> 84
>        at Otp.OtpPeer.connect(OtpSelf self) in C:\Documents and
> Settings\Administrator\Desktop\jungerl\lib\otp.net\Otp\OtpPeer.cs:line 67
>        at ErlTestClient.Form1.button1_Click(Object sender, EventArgs e) in
> C:\Documents and Settings\Administrator\My
> Documents\Projects\ErlTestClient\ErlTestClient\Form1.cs:line 25
>        at System.Windows.Forms.Control.OnClick(EventArgs e)
>        at System.Windows.Forms.Button.OnClick(EventArgs e)
>        at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
>        at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
> button, Int32 clicks)
>        at System.Windows.Forms.Control.WndProc(Message& m)
>        at System.Windows.Forms.ButtonBase.WndProc(Message& m)
>        at System.Windows.Forms.Button.WndProc(Message& m)
>        at
> System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
>        at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&
> m)
>        at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
> Int32 msg, IntPtr wparam, IntPtr lparam)
>        at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
> msg)
>        at
> System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
> dwComponentID, Int32 reason, Int32 pvLoopData)
>        at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
> reason, ApplicationContext context)
>        at
> System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
> ApplicationContext context)
>        at System.Windows.Forms.Application.Run(Form mainForm)
>        at ErlTestClient.Program.Main() in C:\Documents and
> Settings\Administrator\My
> Documents\Projects\ErlTestClient\ErlTestClient\Program.cs:line 17
>        at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
> args)
>        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>        at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>        at System.Threading.ThreadHelper.ThreadStart()
> 
> 
> You can view my source at http://paste.lisp.org/display/67861 and
> http://paste.lisp.org/display/67862
> 
> Erlang is v5.6.3 on windows and I'm running VS2005.
> 
> Please help :)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list