Re: Re-configuring remoting from config file during application session
From: M.Posseth (michelp_at_nohausystems.nl)
Date: 12/29/04
- Next message: Arnaud Debaene: "Re: is there a way for a client to detect a server on the network"
- Previous message: Daniel Fisher\(lennybacon\): "Re: Good WAP resources for palm-pilots"
- In reply to: SA: "Re-configuring remoting from config file during application session"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Dec 2004 08:43:41 +0100
Well i encountered a simular problem when i didn`t knew exactly what the
server `s ip / name or port is
as my program is beeing shipped to customers i do not know how and on wich
computer the server is configured
so instead of the need to change the config file and restart the app every
time , i came up with this solution
VB.NET Code ::::::::
Private Sub frmMain_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(New
System.Runtime.Remoting.Channels.Tcp.TcpChannel)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Try
cRemote = CType(Activator.GetObject(Type.GetType("RemotingSample.NHSBL,
RemoteBL"), "tcp://" & TextBox1.Text & ":" & NumericUpDown.Value.ToString()
& "/NHSBL"), RemotingSample.NHSBL)
cRemote.NewClient()
Catch ex As Exception
Label2.Text = "Could not connect to the service ! " & vbCrLf & "are you sure
the service is running ? "
Label2.Visible = True
Beep()
Exit Sub
End Try
blnConnected = True
End Sub
in textbox1 the user can enter the ip or servername and try to connect to
the service
i am currently bussy to find a way that i can do a broadcast on the network
to discover the availlable running servers so the user can make a selection
in a drop down list ( see my previous post ) however it seems i am
inventing the weel ( again ??? )
Met vriendelijke groet
Kind regards,
Michel Posseth
Software Developer
Microsoft Certified Professional
Company : Nohau Systems B.V.
Division : Systems Development
"SA" <informatica@freemail.nl> wrote in message
news:%23Nj68oP7EHA.2196@TK2MSFTNGP11.phx.gbl...
> Hi all,
>
> I am fairly new to remoting.
>
> I have successfully set up a remoting Winforms client that communicates
over
> TCP (binary) with a Windows Service.
>
> The nature of the project is such that we may have to communicate with 2
or
> more services. The URIs are provided to the program by the user, but the
> channel and formatter info is in the config file.
>
> Adding the first URI is not a problem: I read the config file and then
> create the object using System.Activator.GetObject. However, for the
second
> URI, when I read the config file, I get an error message stating that the
> application name has already been set.
>
> The easy solution seems to me to check whether remoting has already been
> configured, but I can't find out how to do that.
>
> Any help is appreciated.
>
> ---
>
> Sven.
>
>
- Next message: Arnaud Debaene: "Re: is there a way for a client to detect a server on the network"
- Previous message: Daniel Fisher\(lennybacon\): "Re: Good WAP resources for palm-pilots"
- In reply to: SA: "Re-configuring remoting from config file during application session"
- Messages sorted by: [ date ] [ thread ]