![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
As you noted, the config file should only be read once prior to attempting to create any remote objects. Usually it is sufficient to read the file as part of the application startup (i.e. in Main() prior to starting your application logic). Then you'll be guaranteed that whenever you use remoting in your app, the framework will be ready. Is there any reason this wouldn't be appropriate for what you're doing? Ken "SA" <informatica (AT) freemail (DOT) nl> wrote in message news:%23Nj68oP7EHA.2196 (AT) TK2MSFTNGP11 (DOT) 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. |
#5
| |||
| |||
|
| 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.R egisterChannel(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("RemotingSa mple.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 (AT) freemail (DOT) nl> wrote in message news:%23Nj68oP7EHA.2196 (AT) TK2MSFTNGP11 (DOT) 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. |
#6
| |||
| |||
|
|
Hi Ken: Thanks for the reply. Yes, I need to be able to configure connections to two different servers for the same object ;o) I guess that's not likely to happen with remoting. -- --- Sven. "Ken Kolda" <ken.kolda (AT) elliemae-nospamplease (DOT) com> wrote in message news:OPns#tP7EHA.2196 (AT) TK2MSFTNGP14 (DOT) phx.gbl... As you noted, the config file should only be read once prior to attempting to create any remote objects. Usually it is sufficient to read the file as part of the application startup (i.e. in Main() prior to starting your application logic). Then you'll be guaranteed that whenever you use remoting in your app, the framework will be ready. Is there any reason this wouldn't be appropriate for what you're doing? Ken "SA" <informatica (AT) freemail (DOT) nl> wrote in message news:%23Nj68oP7EHA.2196 (AT) TK2MSFTNGP11 (DOT) 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. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |