473,418 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Urgent .net remoting help!

Im trying to build a simple chat app... here is the code:

server
visual basic
code:--------------------------------------------------------------------------------
Public Class ChatServer

Public Sub New()
Try
Dim serversink As New BinaryServerFormatterSinkProvider
serversink.TypeFilterLevel =
Runtime.Serialization.Formatters.TypeFilterLevel.F ull
Dim clientsink As IClientFormatterSinkProvider
clientsink = New BinaryClientFormatterSinkProvider
Dim port As IDictionary

port = New Hashtable

port("port") = 6000

Dim channel As httpChannel = New httpChannel(port, clientsink,
serversink)

ChannelServices.RegisterChannel(channel)
RemotingConfiguration.RegisterWellKnownServiceType (GetType(RemoteChatObj), _

"RemoteChat", _

WellKnownObjectMode.Singleton)
Catch ex As Exception
Throw New ApplicationException("The remote object or the channel
could not be created", ex)
End Try

End Sub
End Clas
--------------------------------------------------------------------------------
I start the server by using dim server as new chatserver in my server
console app

Here is the remote object

visual basic
code:--------------------------------------------------------------------------------
Public Class RemoteChatObj
Inherits MarshalByRefObject
Implements IChat

Public Event evtReceiveText As IChat.MessageEventHandler Implements
IChat.MessageEvent

Public Sub Send(ByVal sender As String, ByVal message As String)
Implements IChat.Send
RaiseEvent evtReceiveText(sender, message)
End Sub
End Class

--------------------------------------------------------------------------------
the interface
visual basic
code:--------------------------------------------------------------------------------
Public Interface IChat
Sub Send(ByVal sender As String, ByVal message As String)
Delegate Sub MessageEventHandler(ByVal sender As String, ByVal message
As String)
Event MessageEvent As MessageEventHandler

End Interfac
--------------------------------------------------------------------------------
and finally the server:
visual basic
code:--------------------------------------------------------------------------------
Private Sub frmClient_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Dim channel As IChannel = New HttpChannel(666)
'ChannelServices.RegisterChannel(channel)

Try
dim iRemote as IChat

iRemote = CType(Activator.GetObject(GetType(IChat), _
"http://localhost:6000/RemoteChat"), IChat)

AddHandler iRemote.MessageEvent, AddressOf OnRecievedMessage
Catch ex As Exception
MessageBox.Show("Error")
End Try

End Su
--------------------------------------------------------------------------------

I get an error at the activator.GetObject line, and at the addhandler line

For some reason the remote object isn't creatted properly... I don't
understand...

The iRemote is of type transparentproxy when that getobject line has been
executed.. and then it fails at the addhandler line
I need urgent help on this now, it is being used in a demo for .net
remoting... Just my luck that the darned thing refuses to run..

The exception I get att the addhandler line is

"System.ArgumentNullException: No message was deserialized prior to calling
the DispatchChannelSink.
Parameter name: requestMsg
at
System.Runtime.Remoting.Channels.DispatchChannelSi nk.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders,
Stream& responseStream)
at
System.Runtime.Remoting.Channels.BinaryServerForma tterSink.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders,
Stream& responseStream)
at
System.Runtime.Remoting.Channels.Http.HttpServerTr ansportSink.ServiceRequest(Object state)
at System.Runtime.Remoting.Channels.SocketHandler.Pro cessRequestNow()
" String
Help please!!!

Henrik
Jul 21 '05 #1
0 1455

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: sunnyz | last post by:
hi I wanted to know whether we can store something in Session objects in webservice.My windows application calls the webservice and i want the data to be stored in Session object so that each user...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
2
by: Ahmet AKGUN | last post by:
Hi; I am trying to make a server that handles db connection pool. Clients use TcpChannel to make a call to this server and get one database connection (OleDbConnection) from pool. But when I...
0
by: Diego F. | last post by:
I hope you can help me with that. I need to pass messages (strings) from a web service to a windows forms application. The application just has a ListBox to receive the messages and it's only a...
6
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or...
1
by: Yuri Ch | last post by:
Hi all, I'm quite new in C# and have no expirience in sockets. I have no idea how to implement the following app, but for expirienced developer, I suppose it should be very trivial... I have...
0
by: Henrik Nordgren | last post by:
Im trying to build a simple chat app... here is the code: server visual basic code:-------------------------------------------------------------------------------- Public Class ChatServer ...
2
by: erbilkonuk | last post by:
Hi, I am very new to .NET Remoting and I try to run a simple program to subscribe to an event raised by Remoting Class. The Remoting Server initiates an instance of Remoting Class as Singleton /...
0
by: Kristian Reukauff | last post by:
Hi I have a problem with the .Net-Securty-Functions. I've got a client and a server. When I try to register a channel at the server with this line: ChannelServices.RegisterChannel(chan, false);...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.