473,320 Members | 1,572 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,320 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 1446

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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.