473,549 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .RegisterChanne l(channel);

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

ChannelServices .UnregisterChan nel(channel);
channel = null;

GC.Collect (); //desperate attempt
GC.WaitForPendi ngFinalizers (); //desperate attempt

RemotingService s.Disconnect(my LocalClass);

....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 7414
In article <a3************ *************** *@phx.gbl>,
an*******@discu ssions.microsof t.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*******@disc ussions.microso ft.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*******@discu ssions.microsof t.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 "StopListen ing" 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*******@disc ussions.microso ft.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 "StopListen ing" method. Perhaps you couldtry calling that before unregistering the channel.

In fact, maybe you could use the StopListening/StartListening instead ofunregisterin g 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*******@disc ussions.microso ft.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 "StopListen ing" method. Perhaps you couldtry calling that before unregistering the channel.

In fact, maybe you could use the StopListening/StartListening instead ofunregisterin g 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
3036
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 try to connect to server using TcpChannel, I get this message "Only one usage of each socket address (protocol/network adress /port)" is normally...
1
4773
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 server on the client? Thanks, Nadav.
2
303
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 ApplicationException("Configure remoting first"); }
2
1580
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 locally, is there any way of preventing this - i.e. can I tell it that I only want to accept local connections? RemoteAgent is my shared type; the...
4
2986
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 GetDirectoryRoot() { return new DirectoryEntry("LDAP://RootDSE"); }
5
3864
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 my program handles the command line arguments well. However, after my program has been running for a little while (say 5-10 minutes) the command...
4
1449
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 fine. I'd like to kick off some activity and block until the activity completes. The completion arrives as a COM call back on a thread from the...
0
930
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. Only thing that is necessary for kerberos authentication is that service principal name has to be specified (e.g. in config). I am able to...
1
3812
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 up a custom channel sink pair? any examples of something like this? I just need basic username and password and the ability to know who sent what...
0
7461
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7491
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6055
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3509
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3491
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1068
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.