title: SignalR Hosting on Local Area Network
body: <p>I am developing winform application. It is working on two computer. MSSQLSERVER installed on main(host) computer. The program has working on main computer with no error.</p>
  
  <p>I have a SignalR server(Windows Forms) that host on a computer of which IP is (192.168.1.5)</p>
  
  <p>However, when i put that ip adress, program does not work. It always works on localhost why ?</p>
  
  <pre><code>    public partial class WinFormsClient : Form
  {
      /// &lt;summary&gt;
      /// This name is simply added to sent messages to identify the user; this 
      /// sample does not include authentication.
      /// &lt;/summary&gt;
      private String UserName { get; set; }
      private IHubProxy HubProxy { get; set; }
  
      const string ServerURI = "http://localhost:1313/signalr";
      private HubConnection Connection { get; set; }
  
      internal WinFormsClient()
      {
          InitializeComponent();
      }
  
      private void ButtonSend_Click(object sender, EventArgs e)
      {
          HubProxy.Invoke("Send", UserName, TextBoxMessage.Text);
          TextBoxMessage.Text = String.Empty;
          TextBoxMessage.Focus();
      }
  
      /// &lt;summary&gt;
      /// Creates and connects the hub connection and hub proxy. This method
      /// is called asynchronously from SignInButton_Click.
      /// &lt;/summary&gt;
      private async void ConnectAsync()
      {
  
  
          Connection = new HubConnection(ServerURI);
          Connection.Closed += Connection_Closed;
          HubProxy = Connection.CreateHubProxy("MyHub");
          //Handle incoming event from server: use Invoke to write to console from SignalR's thread
          HubProxy.On&lt;string, string&gt;("AddMessage", (name, message) =&gt;
              this.Invoke((Action)(() =&gt;
                  RichTextBoxConsole.AppendText(String.Format("{0}: {1}" + Environment.NewLine, name, message))
              ))
          );
  
          HubProxy.On&lt;string&gt;("CallForReport", (message) =&gt;
                  this.Invoke((Action)(() =&gt;
                      RichTextBoxConsole.AppendText(String.Format("{0}" + Environment.NewLine, message))
              ))
          );
  
          try
          {
              await Connection.Start();
          }
          catch (HttpRequestException)
          {
              StatusText.Text = "Unable to connect to server: Start server before connecting clients.";
              //No connection: Don't enable Send button or show chat UI
              return;
          }
  
          //Activate UI
          SignInPanel.Visible = false;
          ChatPanel.Visible = true;
          ButtonSend.Enabled = true;
          TextBoxMessage.Focus();
          RichTextBoxConsole.AppendText("Connected to server at " + ServerURI + Environment.NewLine);
      }
  
      /// &lt;summary&gt;
      /// If the server is stopped, the connection will time out after 30 seconds (default), and the 
      /// Closed event will fire.
      /// &lt;/summary&gt;
      private void Connection_Closed()
      {
          //Deactivate chat UI; show login UI. 
          this.Invoke((Action)(() =&gt; ChatPanel.Visible = false));
          this.Invoke((Action)(() =&gt; ButtonSend.Enabled = false));
          this.Invoke((Action)(() =&gt; StatusText.Text = "You have been disconnected."));
          this.Invoke((Action)(() =&gt; SignInPanel.Visible = true));
      }
  
      private void SignInButton_Click(object sender, EventArgs e)
      {
          UserName = UserNameTextBox.Text;
          //Connect to server (use async method to avoid blocking UI thread)
          if (!String.IsNullOrEmpty(UserName))
          {
              StatusText.Visible = true;
              StatusText.Text = "Connecting to server...";
              ConnectAsync();
          }
      }
  
      private void WinFormsClient_FormClosing(object sender, FormClosingEventArgs e)
      {
          if (Connection != null)
          {
              Connection.Stop();
              Connection.Dispose();
          }
      }
  }
  </code></pre>
  
  <p>I would like to change localhost to (192.168.1.5:1313)
  After that, I would like to recivemessage from client to server.</p>
  
  <p>Client 1 IP is (192.168.1.5)
  Client 2 IP is (192.168.1.20)</p>
  
  <p>SignlaR Hub + MSSQLSERVER + Client1 in the same computer.</p>