473,388 Members | 1,207 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,388 software developers and data experts.

remoting channel release?!?

Hi,
I'm working with .NET Remoting. I have a problem
unregistering the server channel when I try to reuse it
closing and reopening it in the same application. The
second time I try to get an instance of the same channel
it returns an exception with socket code 10048 (already in
use).

My server code is,
....for openning:

myLocalClass = new TheRemoteClass();
channel = new HttpChannel (8888);
ChannelServices.RegisterChannel(channel);

ObjRef ref1 = RemotingServices.Marshal
(myLocalClass, "ClassURI");
....for closing:

ChannelServices.UnregisterChannel(channel);
channel = null;

GC.Collect (); //desperate attempt
GC.WaitForPendingFinalizers (); //desperate attempt

RemotingServices.Disconnect(myLocalClass);

....so, after calling the closing code I would like to call
again the openning code to restart the connection, but the
SocketException appears at "channel = new HttpChannel
(8888);"
The solution must not be to maintain the channel opened;
no way.

Is there any unknown bug? (I've read about a similar
problem in the Beta version)
Am I doing anything wrong?

Thank you in advance,
Edgar

Nov 15 '05 #1
5 7406
In article <a3****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
I'm working with .NET Remoting. I have a problem
unregistering the server channel when I try to reuse it
closing and reopening it in the same application. The
second time I try to get an instance of the same channel
it returns an exception with socket code 10048 (already in
use).


According to this newsgroup post:

http://tinyurl.com/2vmp4

"If you look at the way sockets work, when you close them, unless you
specify otherwise, they will take a few minutes (I thought it
was more like 4 or 5) for them to become available. This is normal and
customary behavior. This is done to allow the remote
connection to actually timeout and recognize that the socket went away.
You can override it on the Socket to close immediately and
be recycled."

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #2

First of all, thanks for your reply Patrick.

I saw a similar solution somewhere but I tried waiting and
more than 20 minutes after, nothing happened.
Anyway, I'm using it on a server application being full of
different communication channels, so is not a good
solution that a remote process waits for the channel to be
restarted an unknown time after a reconfiguration...

Should this be the only solution?, any other way?

Thank you again,
EdgarBM

-----Original Message-----
In article <a3****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
I'm working with .NET Remoting. I have a problem
unregistering the server channel when I try to reuse it
closing and reopening it in the same application. The
second time I try to get an instance of the same channel it returns an exception with socket code 10048 (already in use).
According to this newsgroup post:

http://tinyurl.com/2vmp4

"If you look at the way sockets work, when you close

them, unless youspecify otherwise, they will take a few minutes (I thought itwas more like 4 or 5) for them to become available. This is normal andcustomary behavior. This is done to allow the remote
connection to actually timeout and recognize that the socket went away.You can override it on the Socket to close immediately and
be recycled."

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
.

Nov 15 '05 #3
In article <a4****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
First of all, thanks for your reply Patrick.
No problem.
I saw a similar solution somewhere but I tried waiting and
more than 20 minutes after, nothing happened.
Anyway, I'm using it on a server application being full of
different communication channels, so is not a good
solution that a remote process waits for the channel to be
restarted an unknown time after a reconfiguration...

Should this be the only solution?, any other way?


SOAP and remoting are not my strong points. I looked through the docs
an HttpChannel does have a "StopListening" method. Perhaps you could
try calling that before unregistering the channel.

In fact, maybe you could use the StopListening/StartListening instead of
unregistering and then re-registering the channel?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 15 '05 #4

Thanks for your patience, Patrick,
I tried Start & Stop Listening insteed of Register &
Unregister and the solution also works, but with the same
behaviour.

I just can change the port number (at server and client)
everytime I reconfigure the application. So the work will
began automatically...not a fantastic solution, but it
seems the only way.

Thank you again,
EdgarBM

PS: if you never find a solution for this problem, please
send me any suggestion at eberengena @ appeyron . com.
THANK YOU!!
-----Original Message-----
In article <a4****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
First of all, thanks for your reply Patrick.
No problem.
I saw a similar solution somewhere but I tried waiting and more than 20 minutes after, nothing happened.
Anyway, I'm using it on a server application being full of different communication channels, so is not a good
solution that a remote process waits for the channel to be restarted an unknown time after a reconfiguration...

Should this be the only solution?, any other way?


SOAP and remoting are not my strong points. I looked

through the docsan HttpChannel does have a "StopListening" method. Perhaps you couldtry calling that before unregistering the channel.

In fact, maybe you could use the StopListening/StartListening instead ofunregistering and then re-registering the channel?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
.

Nov 15 '05 #5

I just found one working protocol (not a coding solution)
which can make that the server can reuse the port
inmediatly after the reconfiguration: after unregistering
the server port, if the user tries to connect again to
this closed port, the port on the server will be set free
again!

....it's a "logical" behaviour if we think that the port
can't be reused only if some client has connected, so it's
logical that if this client tries to connect and knows
that it's closed the port doesn't kept alive anymore time
(I've read that the cause of this openned behaviour is to
give time for clients to know the closed state...).
Any way it's a "solution". So programatically I can do
that when the client gets a communication exception it
tries to reopen it in order to send this "signal" to the
actual port...

buff...this brings me so many C programming remembers!

Anyway, thank you Patrick.
-----Original Message-----
In article <a4****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
First of all, thanks for your reply Patrick.
No problem.
I saw a similar solution somewhere but I tried waiting and more than 20 minutes after, nothing happened.
Anyway, I'm using it on a server application being full of different communication channels, so is not a good
solution that a remote process waits for the channel to be restarted an unknown time after a reconfiguration...

Should this be the only solution?, any other way?


SOAP and remoting are not my strong points. I looked

through the docsan HttpChannel does have a "StopListening" method. Perhaps you couldtry calling that before unregistering the channel.

In fact, maybe you could use the StopListening/StartListening instead ofunregistering and then re-registering the channel?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
.

Nov 15 '05 #6

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

Similar topics

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...
1
by: Nadav | last post by:
Hi, I Wonder... Can a server-side class exposed through remoting expose a delegate? In other words: can a client set a server-side delegate that in-turn will be asynchronously called from the...
2
by: frazer | last post by:
i am checking a remoting sample and cant understand what this means. what does this mean? if(!System.Runtime.Remoting.RemotingServices.IsTransparentProxy(Object1)) { throw new...
2
by: Marc Gravell | last post by:
I am using remoting to talk between separate apps *on the same machine*; currently my server startup code is as below, but it throws the XP firewall warning dialog. Since I only need to connect...
4
by: sjoshi | last post by:
Hello All I'm trying this to filter group users bu tI keep getting an unspecified error when invoking FindOne method. Any help is greatly appreciated. public static DirectoryEntry...
5
by: mitch | last post by:
Hello, Basically, I want my application to run only one instance at a time and pass command line arguments to a running instance. I have all of this working, I used the IPC Remoting channel and...
4
by: Grant Schenck | last post by:
Hello, I'm just starting with .NET remoting. Here is what I'm not sure how to handle. I have a IPC Channel remoting server. It exports an object and I can call a method on that object just...
0
by: rp.amit | last post by:
Hi! I use tcp remoting channel and I need to perform user authentication via Kerberos. As I understand, tcp channel uses NegotiateStream that tries Kerberos first and if it falls NTLM is used....
1
by: Smokey Grindel | last post by:
I don't want to use IIS, (design specifiaction) data security isnt an issue, I just want to make a custom authorization and authentication system for my remoting server... how would i do this? set...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.