Re: [Mono-list] Weird remoting problems under Windows.

2005-05-24 Thread Lluis Sanchez
Hi,

My guess is that your problems are due to GTK code running in threads
other than the GUI thread. The remoting infrastructure has its own
thread pool, and remote calls are executed in arbitrary threads taken
from that pool. A solution would be to dispatch all incoming calls in
the GUI thread using ThreadNotify or something like that.

Lluis.

On dv, 2005-05-20 at 16:00 -0700, George Farris wrote:
 I have an app that will remote and run under Linux great but when run
 under Win2k it works a few times and then the entry widget no longer
 shows up.  It's very simple, the client connects to the remote object
 and pops up a simple window asking for a line of text.  There are two
 buttons (cancel, print).  Code follows:
 
 Like I say I can run the server under Linux forever but under windows it
 goes weird and displays everything but the entry widget after working a
 couple of times.
 
 Compiled under Linux, mono 1.0.5 and gtk#-1.9.2
 Windows 2000 has the mono-1.1.7 version.
 
 Any help greatly appreciated.  
 
 
 
 
 Remoting server code:
 -
 using Gtk;
 using System;
 using System.IO;
 using System.Runtime.Remoting;
 using System.Runtime.Remoting.Channels;
 using System.Runtime.Remoting.Channels.Http;
 
 class MainClass
 {
   public static void Main(string[] args)
   {
   Console.WriteLine(Cupsacc-server running, listening on port
 8080...);
   ChannelServices.RegisterChannel(new HttpChannel(8080));
 
 RemotingConfiguration.RegisterWellKnownServiceType(typeof(AccountNumber), 
   control, WellKnownObjectMode.SingleCall);
   
   Console.WriteLine(Application loop...);
   Console.ReadLine();
   }
 }
 
 public class AccountNumber : MarshalByRefObject 
 {
   public string GetAccount()
   {
   Application.Init ();
   MyWindow w = new MyWindow ();
   Application.Run ();
   return (w.AccountNo);
   }
 }
 
 
 
 Gtk code
 --
 using System;
 using Gtk;
 
 public class MyWindow : Window {
   
   private string returnValue;
   private Entry accountNo;
   private Window window;
   
   public MyWindow () : base (Enter account code)
   {
   window = this;
   
   //this.SetDefaultSize (400, 300);
   this.DeleteEvent += new DeleteEventHandler (OnMyWindowDelete);
 
 /* Sets the border width of the window. */
 this.BorderWidth = 10;
 
 HBox entrybox = new HBox();
 entrybox.BorderWidth = 6;
 entrybox.Spacing = 6;
 
 HBox buttonbox = new HBox();
 buttonbox.BorderWidth = 6;
 buttonbox.Spacing = 6;
 
 VBox vb = new VBox();
 vb.Spacing = 6;
 vb.PackStart(entrybox, false, false, 0);
 vb.PackStart(buttonbox, false, false, 0);
 vb.Show();
 
 this.Add(vb);
 
 Label l = new Label(Account Number);
 
 accountNo = new Entry();
 accountNo.Activated += accountNo_cb;
 
 Button print = new Button(Print);
 /* Connect the clicked signal of the button to our callback */
 print.Clicked += print_cb;
 
 Button cancel = new Button(Cancel);
   cancel.Clicked += cancel_cb;
 
 /* Pack and show all our widgets */
 entrybox.Show();
 entrybox.Add(l);
 entrybox.Add(accountNo);
 
 buttonbox.Show();
 buttonbox.Add(print);
 buttonbox.Add(cancel);
 
 print.Show();
 cancel.Show();
   this.ShowAll ();
   
   }
   
 public string AccountNo
 {
   get { return returnValue; }
 }
 
 /* Our callback functions */
 private void print_cb( object obj, EventArgs args)
 {
   returnValue = accountNo.Text;
 window.Destroy();
 Application.Quit();
 }
 
 private void accountNo_cb( object obj, EventArgs args)
 {
   returnValue = accountNo.Text;
 window.Destroy();
 Application.Quit();
 }
 
 private void cancel_cb( object obj, EventArgs args)
 {
 returnValue = null;
 window.Destroy();
 Application.Quit();
 }
 
   
 void OnMyWindowDelete (object o, DeleteEventArgs args)
 {
 returnValue = null;
 window.Destroy(); 
   Application.Quit ();
 }
 }
 
 
 -- 
 George Farris   [EMAIL PROTECTED]
 Malaspina University-College
 
 

___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Weird remoting problems under Windows.

2005-05-24 Thread George Farris
On Tue, 2005-05-24 at 13:11 +0200, Lluis Sanchez wrote:
 Hi,
 
 My guess is that your problems are due to GTK code running in threads
 other than the GUI thread. The remoting infrastructure has its own
 thread pool, and remote calls are executed in arbitrary threads taken
 from that pool. A solution would be to dispatch all incoming calls in
 the GUI thread using ThreadNotify or something like that.
 
 Lluis.

But if it was a problem with the thread pool wouldn't it fail when
running under Linux as well?  Not sure I understand why it only fails to
display one widget but the rest are displayed.  Very strange, seems more
like a bug to me.


-- 
George Farris   [EMAIL PROTECTED]
Malaspina University-College



___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Weird remoting problems under Windows.

2005-05-20 Thread George Farris
I have an app that will remote and run under Linux great but when run
under Win2k it works a few times and then the entry widget no longer
shows up.  It's very simple, the client connects to the remote object
and pops up a simple window asking for a line of text.  There are two
buttons (cancel, print).  Code follows:

Like I say I can run the server under Linux forever but under windows it
goes weird and displays everything but the entry widget after working a
couple of times.

Compiled under Linux, mono 1.0.5 and gtk#-1.9.2
Windows 2000 has the mono-1.1.7 version.

Any help greatly appreciated.  




Remoting server code:
-
using Gtk;
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine(Cupsacc-server running, listening on port
8080...);
ChannelServices.RegisterChannel(new HttpChannel(8080));

RemotingConfiguration.RegisterWellKnownServiceType(typeof(AccountNumber), 
control, WellKnownObjectMode.SingleCall);

Console.WriteLine(Application loop...);
Console.ReadLine();
}
}

public class AccountNumber : MarshalByRefObject 
{
public string GetAccount()
{
Application.Init ();
MyWindow w = new MyWindow ();
Application.Run ();
return (w.AccountNo);
}
}



Gtk code
--
using System;
using Gtk;

public class MyWindow : Window {

private string returnValue;
private Entry accountNo;
private Window window;

public MyWindow () : base (Enter account code)
{
window = this;

//this.SetDefaultSize (400, 300);
this.DeleteEvent += new DeleteEventHandler (OnMyWindowDelete);

/* Sets the border width of the window. */
this.BorderWidth = 10;

HBox entrybox = new HBox();
entrybox.BorderWidth = 6;
entrybox.Spacing = 6;

HBox buttonbox = new HBox();
buttonbox.BorderWidth = 6;
buttonbox.Spacing = 6;

VBox vb = new VBox();
vb.Spacing = 6;
vb.PackStart(entrybox, false, false, 0);
vb.PackStart(buttonbox, false, false, 0);
vb.Show();

this.Add(vb);

Label l = new Label(Account Number);

accountNo = new Entry();
accountNo.Activated += accountNo_cb;

Button print = new Button(Print);
/* Connect the clicked signal of the button to our callback */
print.Clicked += print_cb;

Button cancel = new Button(Cancel);
cancel.Clicked += cancel_cb;

/* Pack and show all our widgets */
entrybox.Show();
entrybox.Add(l);
entrybox.Add(accountNo);

buttonbox.Show();
buttonbox.Add(print);
buttonbox.Add(cancel);

print.Show();
cancel.Show();
this.ShowAll ();

}

public string AccountNo
{
get { return returnValue; }
}

/* Our callback functions */
private void print_cb( object obj, EventArgs args)
{
returnValue = accountNo.Text;
window.Destroy();
Application.Quit();
}

private void accountNo_cb( object obj, EventArgs args)
{
returnValue = accountNo.Text;
window.Destroy();
Application.Quit();
}

private void cancel_cb( object obj, EventArgs args)
{
returnValue = null;
window.Destroy();
Application.Quit();
}


void OnMyWindowDelete (object o, DeleteEventArgs args)
{
returnValue = null;
window.Destroy();   
Application.Quit ();
}
}


-- 
George Farris   [EMAIL PROTECTED]
Malaspina University-College


-- 
George Farris   [EMAIL PROTECTED]
Malaspina University-College



___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list