Free cookie consent management tool by TermsFeed Policy Generator

Ticket #96: GridPlugin.patch

File GridPlugin.patch, 5.9 KB (added by gkronber, 16 years ago)

suggested patch by pspitzli

  • ClientForm.cs

     
    5757    }
    5858
    5959    private void startButton_Click(object sender, EventArgs e) {
    60       clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8002/Grid/Client";
     60      //clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8002/Grid/Client";
     61      string hostname = Dns.GetHostName();
     62      IPAddress[] addresses = Dns.GetHostAddresses(hostname);
     63
     64      // Thanks to Microsoft
     65      if (System.Environment.OSVersion.Version.Major >= 6) {
     66        clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":" + clientPort.Text +"/Grid/Client";
     67      } else {
     68        clientUrl = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":" + clientPort.Text +"/Grid/Client";
     69      }
     70
    6171      clientHost = new ServiceHost(this, new Uri(clientUrl));
    6272      try {
    6373        NetTcpBinding binding = new NetTcpBinding();
  • ClientForm.designer.cs

     
    5050      this.addressTextBox = new System.Windows.Forms.TextBox();
    5151      this.statusLabel = new System.Windows.Forms.Label();
    5252      this.statusTextBox = new System.Windows.Forms.TextBox();
     53      this.label2 = new System.Windows.Forms.Label();
     54      this.clientPort = new System.Windows.Forms.TextBox();
    5355      this.SuspendLayout();
    5456      //
    5557      // label1
     
    6567      //
    6668      this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    6769      this.stopButton.Enabled = false;
    68       this.stopButton.Location = new System.Drawing.Point(99, 74);
     70      this.stopButton.Location = new System.Drawing.Point(99, 87);
    6971      this.stopButton.Name = "stopButton";
    7072      this.stopButton.Size = new System.Drawing.Size(75, 23);
    7173      this.stopButton.TabIndex = 6;
     
    7678      // startButton
    7779      //
    7880      this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    79       this.startButton.Location = new System.Drawing.Point(15, 74);
     81      this.startButton.Location = new System.Drawing.Point(15, 87);
    8082      this.startButton.Name = "startButton";
    8183      this.startButton.Size = new System.Drawing.Size(75, 23);
    8284      this.startButton.TabIndex = 5;
     
    9496      // statusLabel
    9597      //
    9698      this.statusLabel.AutoSize = true;
    97       this.statusLabel.Location = new System.Drawing.Point(9, 36);
     99      this.statusLabel.Location = new System.Drawing.Point(9, 56);
    98100      this.statusLabel.Name = "statusLabel";
    99101      this.statusLabel.Size = new System.Drawing.Size(67, 13);
    100102      this.statusLabel.TabIndex = 8;
     
    102104      //
    103105      // statusTextBox
    104106      //
    105       this.statusTextBox.Location = new System.Drawing.Point(96, 33);
     107      this.statusTextBox.Location = new System.Drawing.Point(96, 53);
    106108      this.statusTextBox.Name = "statusTextBox";
    107109      this.statusTextBox.ReadOnly = true;
    108110      this.statusTextBox.Size = new System.Drawing.Size(222, 20);
    109111      this.statusTextBox.TabIndex = 9;
    110112      //
     113      // label2
     114      //
     115      this.label2.AutoSize = true;
     116      this.label2.Location = new System.Drawing.Point(9, 32);
     117      this.label2.Name = "label2";
     118      this.label2.Size = new System.Drawing.Size(57, 13);
     119      this.label2.TabIndex = 10;
     120      this.label2.Text = "Client port:";
     121      //
     122      // clientPort
     123      //
     124      this.clientPort.Location = new System.Drawing.Point(96, 29);
     125      this.clientPort.Name = "clientPort";
     126      this.clientPort.Size = new System.Drawing.Size(222, 20);
     127      this.clientPort.TabIndex = 11;
     128      this.clientPort.Text = "8002";
     129      //
    111130      // ClientForm
    112131      //
    113132      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    114133      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    115       this.ClientSize = new System.Drawing.Size(330, 109);
     134      this.ClientSize = new System.Drawing.Size(330, 122);
     135      this.Controls.Add(this.clientPort);
     136      this.Controls.Add(this.label2);
    116137      this.Controls.Add(this.statusTextBox);
    117138      this.Controls.Add(this.statusLabel);
    118139      this.Controls.Add(this.label1);
     
    134155    private System.Windows.Forms.TextBox addressTextBox;
    135156    private System.Windows.Forms.Label statusLabel;
    136157    private System.Windows.Forms.TextBox statusTextBox;
     158    private System.Windows.Forms.Label label2;
     159    private System.Windows.Forms.TextBox clientPort;
    137160  }
    138161}
  • ServerForm.cs

     
    4242
    4343    public ServerForm() {
    4444      InitializeComponent();
    45       externalAddressTextBox.Text = "net.tcp://"+Dns.GetHostAddresses(Dns.GetHostName())[0]+":8000/Grid/Service";
    46       internalAddressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8001/Grid/JobStore";
     45
     46      // Thanks to Microsoft
     47      if (System.Environment.OSVersion.Version.Major >= 6) {
     48        externalAddressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":8000/Grid/Service";
     49      } else {
     50        externalAddressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8000/Grid/Service";
     51      }
     52      if (System.Environment.OSVersion.Version.Major >= 6) {
     53        internalAddressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[2] + ":8001/Grid/JobStore";
     54      } else {
     55        internalAddressTextBox.Text = "net.tcp://" + Dns.GetHostAddresses(Dns.GetHostName())[0] + ":8001/Grid/JobStore";
     56      }
     57
    4758      jobStore = new EngineStore();
    4859      server = new GridServer(jobStore);
    4960