Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Remoting( Database as a Model , in a MVC pattern)

Remoting( Database as a Model , in a MVC pattern)

Scheduled Pinned Locked Moved C#
databasecsharpasp-netregexarchitecture
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soviet
    wrote on last edited by
    #1

    I need to know how would i remotely call methods on another pc(program) when my database(sql) changes(update occurs).I need to notify my viewing program(GUI) of the changes allowing immediatly show the changes as the database changes. How would this be done in C#. Triggers? I am very new to C# links to some nice tuts would be helpful as well as any other suggestions on how i would tackle this. Thank you:confused:

    I 1 Reply Last reply
    0
    • S Soviet

      I need to know how would i remotely call methods on another pc(program) when my database(sql) changes(update occurs).I need to notify my viewing program(GUI) of the changes allowing immediatly show the changes as the database changes. How would this be done in C#. Triggers? I am very new to C# links to some nice tuts would be helpful as well as any other suggestions on how i would tackle this. Thank you:confused:

      I Offline
      I Offline
      if_mel_yes_else_no
      wrote on last edited by
      #2

      There are plenty of ways I'm sure, but I've always had the best success with custom TCP protocols. Meaning, you would connect to the remote computer through a TCP Client on a dedicated port, and send your own message format to the remote computer. The remote computer should have a thread that is constantly listening on that port for new connections. When it receives your connection, it verifies that it came from you (your custom message format should have a username/password in it), and performs the necessary operation based on the message. This approach has yet to fail me.

      S 1 Reply Last reply
      0
      • I if_mel_yes_else_no

        There are plenty of ways I'm sure, but I've always had the best success with custom TCP protocols. Meaning, you would connect to the remote computer through a TCP Client on a dedicated port, and send your own message format to the remote computer. The remote computer should have a thread that is constantly listening on that port for new connections. When it receives your connection, it verifies that it came from you (your custom message format should have a username/password in it), and performs the necessary operation based on the message. This approach has yet to fail me.

        S Offline
        S Offline
        Soviet
        wrote on last edited by
        #3

        that sound great, is there perhaps some links to samples explaining in more detail, as i said i am new to programming. thanx again:~

        I 1 Reply Last reply
        0
        • S Soviet

          that sound great, is there perhaps some links to samples explaining in more detail, as i said i am new to programming. thanx again:~

          I Offline
          I Offline
          if_mel_yes_else_no
          wrote on last edited by
          #4

          If you've never set up a TcpClient, studio 2005 makes it pretty easy. Same for the TcpListener on the remote computer. //DataBase Computer TcpClient m_connection = new TcpClient("15.3.6.33", 17534); StreamWriter m_writer = m_connection.GetStream(); m_writer.WriteLine("(app)(username)mel(/username)(password)mel(/password)" + "(command)REFRESH(/command)(/app)"); //Remote Computer TcpListener m_listener = new TcpListener(17534); TcpClient m_connection; StreamReader m_reader; String strCommandText; m_listener.Start(); while(true) { if (m_listener.Pending()) { m_connection = m_listener.AcceptTcpClient(); m_reader = m_connection.GetStream(); strCommandText = m_reader.ReadLine(); // Now parse your message to find out what you should do. } } -- modified at 18:16 Tuesday 30th August, 2005

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups