Click here to Skip to main content
15,911,360 members
Home / Discussions / C#
   

C#

 
AnswerRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:24
mid=574124-Oct-07 16:24 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:29
JoeRip24-Oct-07 16:29 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 16:31
mid=574124-Oct-07 16:31 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:35
JoeRip24-Oct-07 16:35 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
JoeRip24-Oct-07 16:51
JoeRip24-Oct-07 16:51 
GeneralRe: Getting NullReferenceException instead of ArgumentNullException Pin
mid=574124-Oct-07 17:18
mid=574124-Oct-07 17:18 
QuestionMerging Config files Pin
KrunalC24-Oct-07 15:50
KrunalC24-Oct-07 15:50 
QuestionRemoting and Events Issue Pin
nbize24-Oct-07 13:58
nbize24-Oct-07 13:58 
I'm having an issue trying to get my clients to handle messages that are passed from a server to a shared object... Any remoting gurus out there are free to enlighten me... D'Oh! | :doh: Smile | :)

Ok.. First of all, here is the interface created to by implemented by the remote object:

namespace WarComInterface<br />
{<br />
 <br />
    public delegate void ServerToClientEvent(object sender, ServerToClientEventArgs e);<br />
 <br />
    // Interface implemented by shared object, provides methods and events for clients.<br />
    public interface ICom<br />
    {<br />
        // Main methods to load up data from a player with name 'nomJoueur'<br />
        Joueur clientReqJoueur(string nomJoueur);<br />
 <br />
        // Event fired up by the Server to notice Clients. Clients must register to this EventHandler<br />
        event ServerToClientEvent ServerToClientMsg;<br />
 <br />
        // Method called from a client to send message to Server<br />
        void clientMsg(EventTypes.EventsFromClient typeEvent, string nomJoueur);<br />
    }<br />
}


Now, here is the part where the client gets a reference to the remote object and sets a handler to listen for events coming from the server:

<br />
        try<br />
            {<br />
                TcpChannel channel = new TcpChannel();<br />
                ChannelServices.RegisterChannel(channel, false);<br />
                remoteComm = (WarComInterface.ICom)Activator.GetObject(typeof(WarComInterface.ICom),<br />
                    "tcp://"+txt_adrip.Text + ":1069/jh");<br />
 <br />
                // Register for events coming from server, goto MessageFromServer call<br />
                remoteComm.ServerToClientMsg += new ServerToClientEvent(MessageFromServer);<br />
<br />



And finally, this is the part inside the shared object. It's within a public method called by the server (some sort of public void sendMsg())

<br />
                    // Fire up a new event to Update Stats -> This should be caught by all clients<br />
                    evArg = new ServerToClientEventArgs(EventTypes.EventsFromServer.UpdateStats, targetPlayer);<br />
                    if (ServerToClientMsg != null)<br />
                    {<br />
                        ServerToClientMsg(this, evArg); <br />
                    }<br />


It fires up the following exception : This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.

Any help would be greatly appreciated!
AnswerRe: Remoting and Events Issue Pin
John Whitmire2-Nov-07 6:26
professionalJohn Whitmire2-Nov-07 6:26 
QuestionIt seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Khoramdin24-Oct-07 12:35
Khoramdin24-Oct-07 12:35 
AnswerRe: It seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Christian Graus24-Oct-07 12:54
protectorChristian Graus24-Oct-07 12:54 
GeneralRe: It seems that one window sits on the top and doesn't allow other windows to appear on it?!!! Pin
Khoramdin24-Oct-07 17:10
Khoramdin24-Oct-07 17:10 
Question# color Pin
MasterSharp24-Oct-07 11:22
MasterSharp24-Oct-07 11:22 
AnswerRe: # color Pin
Luc Pattyn24-Oct-07 11:36
sitebuilderLuc Pattyn24-Oct-07 11:36 
GeneralRe: # color Pin
MasterSharp24-Oct-07 11:38
MasterSharp24-Oct-07 11:38 
GeneralRe: # color Pin
MasterSharp24-Oct-07 11:42
MasterSharp24-Oct-07 11:42 
GeneralRe: # color Pin
Luc Pattyn24-Oct-07 12:38
sitebuilderLuc Pattyn24-Oct-07 12:38 
Questionauto-method [modified] Pin
MasterSharp24-Oct-07 10:55
MasterSharp24-Oct-07 10:55 
AnswerRe: auto-method Pin
il_masacratore24-Oct-07 11:12
il_masacratore24-Oct-07 11:12 
GeneralRe: auto-method Pin
MasterSharp24-Oct-07 11:22
MasterSharp24-Oct-07 11:22 
GeneralRe: auto-method Pin
Christian Graus24-Oct-07 12:28
protectorChristian Graus24-Oct-07 12:28 
QuestionModular Program Pin
murtle324-Oct-07 9:38
murtle324-Oct-07 9:38 
QuestionRe: Modular Program Pin
TJoe24-Oct-07 9:48
TJoe24-Oct-07 9:48 
AnswerRe: Modular Program Pin
murtle324-Oct-07 19:06
murtle324-Oct-07 19:06 
GeneralRe: Modular Program Pin
PandemoniumPasha24-Oct-07 19:30
PandemoniumPasha24-Oct-07 19:30 

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.