Click here to Skip to main content
15,885,767 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Reading the contents of a file into an array Pin
Luc Pattyn24-May-12 12:08
sitebuilderLuc Pattyn24-May-12 12:08 
AnswerRe: Reading the contents of a file into an array Pin
Dave Kreskowiak23-May-12 7:20
mveDave Kreskowiak23-May-12 7:20 
GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie23-May-12 7:49
GeorgieMPorgie23-May-12 7:49 
AnswerRe: Reading the contents of a file into an array Pin
Luc Pattyn23-May-12 13:56
sitebuilderLuc Pattyn23-May-12 13:56 
GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie23-May-12 15:48
GeorgieMPorgie23-May-12 15:48 
AnswerRe: Reading the contents of a file into an array Pin
frostcox25-May-12 10:37
frostcox25-May-12 10:37 
GeneralRe: Reading the contents of a file into an array Pin
GeorgieMPorgie25-May-12 16:27
GeorgieMPorgie25-May-12 16:27 
QuestionVB Remoting - How do you get the server to pass value to client? Pin
Cutha22-May-12 19:57
Cutha22-May-12 19:57 
Hi,

Thanks for taking the time to read my post. I have spent lots of time reading other threads on here and everywhere else I could find and could not find a solution to my issue.

What I am trying to accomplish is to have two way communication between a service and a (single - for now) windows gui interface. I have found some basic examples on the web on how to pass a string to the server and playing around with it I was able to pass a Serializable class to the server and using functions get a class back from the server.

What I don't understand and can't figure out is how to get the server (service) to send an update to a client without the client requesting it, like an event. I found a server/client chat program that this works on but it is too complicated for me to follow and figure out how to do it.

Using the below example I changed the server into a Windows Form Application and then in the CommunicationService class I created a reference to the server form and called a public sub I had defined on it to bring the passed string into it. Although that works it is ugly and I am sure it is not the correct way to do it. How would I make more like a typical even driven system?

Below is an example I found on the net and I started with this to try and figure out how to accomplish my goals. What do I need to change or add to make this work the way I want it to?

Client:
VB
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
Public Class Form1

    Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
        Dim ipcCh As New IpcChannel("myClient")
        ChannelServices.RegisterChannel(ipcCh, False)

        Dim obj As SharedInterfaces.ICommunicationService = _
          DirectCast(Activator.GetObject(GetType(SharedInterfaces.ICommunicationService), _
          "ipc://IPChannelName/SreeniRemoteObj"), SharedInterfaces.ICommunicationService)
        obj.SaySomething(txtText.Text)

        ChannelServices.UnregisterChannel(ipcCh)
    End Sub

End Class


Server - CommunicationService Class:
VB
Public Class CommunicationService
    Inherits MarshalByRefObject
    Implements SharedInterfaces.ICommunicationService

    
    Public Sub SaySomething(ByVal text As String) Implements SharedInterfaces.ICommunicationService.SaySomething
        Console.WriteLine("The client said : " & text)
    End Sub
End Class


Server - Main:
VB
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Ipc
 
Module Main
    Sub Main()
        Dim ipcCh As IpcChannel
        ipcCh = New IpcChannel("IPChannelName")

        ChannelServices.RegisterChannel(ipcCh, False)
        RemotingConfiguration.RegisterWellKnownServiceType( _
             GetType(CommunicationService), "SreeniRemoteObj", _
                           WellKnownObjectMode.Singleton)

        Console.WriteLine("Press ENTER to quit")
        Console.ReadLine()
    End Sub
End Module


SharedInterface:
VB
Public Interface ICommunicationService
    Sub SaySomething(ByVal text As String)
End Interface


Thanks for your time Smile | :)

Seamus
VB.Net 2005

AnswerRe: VB Remoting - How do you get the server to pass value to client? Pin
Bernhard Hiller23-May-12 4:14
Bernhard Hiller23-May-12 4:14 
GeneralRe: VB Remoting - How do you get the server to pass value to client? Pin
Cutha24-May-12 14:57
Cutha24-May-12 14:57 
QuestionCrystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad22-May-12 0:09
compad22-May-12 0:09 
QuestionRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
Eddy Vluggen22-May-12 9:05
professionalEddy Vluggen22-May-12 9:05 
AnswerRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad22-May-12 22:33
compad22-May-12 22:33 
GeneralRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
Eddy Vluggen23-May-12 0:18
professionalEddy Vluggen23-May-12 0:18 
GeneralRe: Crystal Report 8.5 Connectivity(Parameterised or data as per record set) with Oracle using VB6 Pin
compad23-May-12 23:31
compad23-May-12 23:31 
QuestionCannot connect to SQL in VB6 COM DLL called from C# Pin
soporificeffect20-May-12 22:34
soporificeffect20-May-12 22:34 
QuestionGet 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Sonhospa18-May-12 8:28
Sonhospa18-May-12 8:28 
AnswerRe: Get 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Dave Kreskowiak22-May-12 5:08
mveDave Kreskowiak22-May-12 5:08 
GeneralRe: Get 1st dimension values of a 2-dimensional array into 1-dimensional array Pin
Sonhospa22-May-12 22:33
Sonhospa22-May-12 22:33 
QuestionWeb Browser without IE 7 dependencies Pin
Brandon-X1200018-May-12 6:51
Brandon-X1200018-May-12 6:51 
AnswerRe: Web Browser without IE 7 dependencies Pin
Dave Kreskowiak18-May-12 8:50
mveDave Kreskowiak18-May-12 8:50 
QuestionRemote Debugging in Visual Basic 6.0 Pin
acects18-May-12 1:05
acects18-May-12 1:05 
AnswerRe: Remote Debugging in Visual Basic 6.0 Pin
Dave Kreskowiak18-May-12 2:09
mveDave Kreskowiak18-May-12 2:09 
GeneralRe: Remote Debugging in Visual Basic 6.0 Pin
acects18-May-12 2:19
acects18-May-12 2:19 
GeneralRe: Remote Debugging in Visual Basic 6.0 Pin
Dave Kreskowiak18-May-12 3:23
mveDave Kreskowiak18-May-12 3:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.