VisualBean
VisualBean

Reputation: 5008

Windows Service communication, sockets, c#

i'm writing a server side application and a windows service which need to be installed on a remote host the service returns CPU usage to the serverside application - this is NOT the problem the serverside application deploys the service on the remote host. - also, not the problem

THE PROBLEM: but how do i setup a socket connection between the two, when i dont want to hardcode the ip address? (for scalability) - do i need to use multicast or is there some devious way of doing this? is there another solution than using sockets? - i'm new to writing Windows Services.

I need help figuring out how to communicate between the server and the service without hardcoding IP-addr.

thank you in advance.

MY SOLUTION: I created a windows service, that reads a xml file with the IP and port of the Server application. so when i deploy my client application, i also create a xml file with the network information. Regards Alex

Upvotes: 1

Views: 1946

Answers (2)

VisualBean
VisualBean

Reputation: 5008

another solution could be to create the service as a console application with arguments (endpoint ip address) and then just deploy it with the arguments on the remote host

Upvotes: 0

ed_me
ed_me

Reputation: 3508

A lot of communication platforms now use network discovery; there's an article on codeproject that goes into detail about using network discovery.

The problem was, I did not know what machine name the server was running on, in fact I wanted this to be flexible, and selectable by the user.

Seems relevant to http://www.codeproject.com/Articles/16113/Retreiving-a-list-of-network-computer-names-using

Have you thought of using WCF?

http://msdn.microsoft.com/en-us/library/ms731082.aspx

Regarding multicast, you can have a WCF server multicast announce it's availability on a network; see http://msdn.microsoft.com/en-us/library/dd456782.aspx

Upvotes: 1

Related Questions