locked
best way to manage local remote servers. RRS feed

  • Question

  • I have a program that works well on our master slave server environment.

    looking at improving the program to run locally on each server. but to have the master node control each node and collect each nodes data on the master node. the goal is to improve process time and expand the data collection.

    not sure how to proceed, remote call or if the is any thing else in c#.net programming.

    any assistance, sample and suggestion?

    Sunday, November 3, 2013 9:02 PM

Answers

  • Although I do agree with Javaman that you will need some sort of networking, I would like to give you a little more info on the subject:

    Pure sockets are pretty much your best choice. Sockets are definitely not an easy thing to use for the first time; they usually require async tasks as well as vigorous debugging to get them to work correctly. You can find many samples just by searching for 'C# Socket' on Bing or Google, but be warned: many of them are hard to understand.

    I don't mean to discourage you in any way; after you master the basics, sockets are easy to use. I am just trying to prepare you and make sure you understand that this might take some time to figure out. Just read through a few samples and try to write a test app. Once you feel comfortable with sockets in a separate program, you can integrate the concepts in to your main app.

    After you can send basic data over a socket, you will have to structure your program something like this:

    • Each time the server makes a connection to a separate 'node', spin off a thread to monitor that socket. Make use of lots of classes and methods to attempt to make the communications as simple as possible at the top-level. I would recommend creating a class that you use for each client that handles the basics (opens and closes the socket, manages incoming messages, etc.). Then make a manager class that keeps a list of those clients and does larger-scale operations.
    • Send data over a standard protocol (I would recommend just serializing an object for communication). Before you get too far in to this, you need to know what form you will use to communicate through the socket (it takes a byte array or string). Check out serialization as a place to start.

    I don't mean to throw so much information at you at once (Sorry if you are confused!), but this is all stuff that you will need to consider before moving on to writing this part of your program. If you need more help, I should be able to give you a sample or some more guidance. This is a common task that you are trying to complete and I am sure that I can write or find a sample for you if you need it.


    Wasabi Fan


    • Edited by Wasabi Fan Monday, November 4, 2013 5:32 AM Fixed grammar
    • Marked as answer by hauld Monday, November 4, 2013 5:03 PM
    Monday, November 4, 2013 5:26 AM

All replies

  • The best and fastest way to do this is to write a Sockets program to do this.  Each of the clients would have to open the socket and read from the server to determine what to do.  We see this all the time with Chat applications, and most client/server applications.   Note, if you want it firewall friendly you would implement this using HTTP protocol.

    JP Cowboy Coders Unite!

    Monday, November 4, 2013 1:56 AM
  • do I have to use HTTP this is not an internet program? my systems will be 2008 servers.

    my program will sit on one machine and it will poll the other machines in the environment.

    Monday, November 4, 2013 4:47 AM
  • Although I do agree with Javaman that you will need some sort of networking, I would like to give you a little more info on the subject:

    Pure sockets are pretty much your best choice. Sockets are definitely not an easy thing to use for the first time; they usually require async tasks as well as vigorous debugging to get them to work correctly. You can find many samples just by searching for 'C# Socket' on Bing or Google, but be warned: many of them are hard to understand.

    I don't mean to discourage you in any way; after you master the basics, sockets are easy to use. I am just trying to prepare you and make sure you understand that this might take some time to figure out. Just read through a few samples and try to write a test app. Once you feel comfortable with sockets in a separate program, you can integrate the concepts in to your main app.

    After you can send basic data over a socket, you will have to structure your program something like this:

    • Each time the server makes a connection to a separate 'node', spin off a thread to monitor that socket. Make use of lots of classes and methods to attempt to make the communications as simple as possible at the top-level. I would recommend creating a class that you use for each client that handles the basics (opens and closes the socket, manages incoming messages, etc.). Then make a manager class that keeps a list of those clients and does larger-scale operations.
    • Send data over a standard protocol (I would recommend just serializing an object for communication). Before you get too far in to this, you need to know what form you will use to communicate through the socket (it takes a byte array or string). Check out serialization as a place to start.

    I don't mean to throw so much information at you at once (Sorry if you are confused!), but this is all stuff that you will need to consider before moving on to writing this part of your program. If you need more help, I should be able to give you a sample or some more guidance. This is a common task that you are trying to complete and I am sure that I can write or find a sample for you if you need it.


    Wasabi Fan


    • Edited by Wasabi Fan Monday, November 4, 2013 5:32 AM Fixed grammar
    • Marked as answer by hauld Monday, November 4, 2013 5:03 PM
    Monday, November 4, 2013 5:26 AM
  • thank you all.

    Wasabi Fan, I will have to digest this and start my research. there might be more question if I decide to go down this rabbit hole.

    Monday, November 4, 2013 5:04 PM
  • Are you directing that at me? I specifically said that I agreed with you and was just giving more detailed information; This is a complex topic and I think that the OP is asking for more than just the suggestion of  'sockets'. There are many more parts to his goal than just the endpoint socket handler.

    Wasabi Fan

    Tuesday, November 5, 2013 6:46 PM
  • Sorry I misread the post.  Yes I'm sure the op wants more information; however, there's tons of sockets examples in C# out there already.  Not specified in the question were what protocol to be used, etc.  So it's kind of pointless to start down a specific solution until we hear back from op.

    JP Cowboy Coders Unite!

    Thursday, November 7, 2013 9:36 PM