473,624 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RMI Registry and UnicastRemoteOb jects - sharing ports

Hello group,

I am trying to cut down the number of ports that must be opened in a
firewall to let the client talk to the protected server. The server runs its
own registry process by calling LocateRegistry. createRegistry( port), and the
same port is used when UnicastRemoteOb jects are exported. This way, I can
tell the firewall admin to open only one hole in the firewall, instead of
two.

It all works, until I attempt to use a custom socket factory for the
registry (the factory explicitly sets the IP address to which the registry
binds - important for the multi-homed servers). If I set the socket factory
to the registry only:

LocateRegistry. createRegistry( port, null, mySocketFactory )

and leave the exported objects to their default factory settings, I get a
"port already in use" exception. If I set the same instance of the socket
factory to the UnicastRemoteOb jects, this is what happens:

1. The first UnicastRemoteOb jects exports normally and responds to the
remote calls.
2. Any other UnicastRemoteOb ject to be exported on the same port with the
same instance of the socket factory throws the same old "port already in
use" exception.

What am I missing in my version of the socket factory that the default
implementation has and what lets it bind multiple objects to the same port
without blowing up?

Here is the source code for the socket factory:

public class RegistrySocketF actory extends RMISocketFactor y implements
Serializable
{
private InetAddress ipInterface = null;
private static RegistrySocketF actory instance = null; // turn this
class into a singleton
public RegistrySocketF actory(InetAddr ess ipInterface)
{
this.ipInterfac e = ipInterface;
instance = this;
}
public static RegistrySocketF actory getInstance()
{
return (instance);
}
public ServerSocket createServerSoc ket(int port)
{
ServerSocket serverSocket = null;
try
{
serverSocket = new ServerSocket(po rt, 50, ipInterface);
}
catch (Exception e)
{
System.out.prin tln(e);
}
return (serverSocket);
}
public Socket createSocket(St ring ipInterface, int port) throws
IOException
{
Socket socket= new Socket(ipInterf ace, port);
return socket;
}
}

And this is the snippet of the context in which it is used:

RegistrySocketF actory socketFactory = new RegistrySocketF actory(address) ;
LocateRegistry. createRegistry( 6541, null, socketFactory);
proxy = new Proxy(6541); // this works
proxyHook = new ProxyHook(this) ; // this throws "port in use"
exception

public Proxy(int port) throws RemoteException
{
super(6541, null, RegistrySocketF actory.getInsta nce());
}

public ProxyHook(Proxy controller) throws RemoteException
{
super(6541, null, RegistrySocketF actory.getInsta nce());
}
Jul 17 '05 #1
0 2170

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

Similar topics

1
4355
by: DavidE | last post by:
Hi, Recently, when I try to open files in web projects with visual interdev 6 I get this error message: Server error: Error 2 opening registry key Software/microsoft/shared tools/web server extensions/ports/port 80 . Well, just in one project I can open its files. I don't know why is the difference between this project and other projects. I tried this solution but it doesn't solve the problem....
1
16318
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." I checked in the Tools - Options - Advance. I have the database shared with no locks selected and record level locking selected.
3
9325
by: andyI | last post by:
Where do I find information on how to address and pass data to and from the serial ports and USB ports in VB. VB6 supports the serial ports easily but I see no reference to using the USB ports. VB.net literature does not provide any coverage on either the serial ports or the USB ports.
3
4606
by: Steve Montgomery | last post by:
Does anyone have a sample block of code they can share for checking a DWORD value on a remote network machine's registry? For example, to validate a patch deployment. MSDN has a great sample for access the local registry bur I'd like to mount several remote registry to check a specific key for a DWORD value. Thanks, Steve
12
3244
by: Li Pang | last post by:
Hi, I'd like to know how to remove registry keys which contain a value of 'appkeyA' or 'appkeyB' or 'appkeyC' ...? thanks in advance
1
10904
by: henrycortezwu | last post by:
Hi All, I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth Serial Port") using VS2005 System.IO.Ports. When I ran the ff code below here's what happens. 1) VS2005 Compiles w/o errors 2) My Nokia 6600 prompted me the message "Accept Connection request from DEMON?" note: DEMON is my computers name. 3) Using my Nokia 6600, I hit the button that refers to the "Yes"
2
3953
by: joaquimfpinto | last post by:
Dear All, I made an app in c# that uses several serial ports. For the serial ports I use a pnp Sunix board, some with 8 serial ports other with 4 or even 2 serial ports. Whenever I use the development computer I don't have ay problem with my application.
1
1507
by: mdfidahussain | last post by:
Hi Friends, Anyone help me out in getting Ports' status information from the Registry Key? if there is no possibility of getting this info from Registry entry, is there any other way from whic I can get Port's info from the Remote server using VB Script Thnx
10
18210
by: sklett | last post by:
I'm trying to send some printer commands (ZPLII) to an attached USB printer using the SerialPort component. I didn't get very far at all. In fact I haven't gotten anywhere. The first problem I encountered is that a call to SerialPort.GetPortNames() returns an empty string. In other words, NO port names are returned. I'm not terribly knowledgable about ports but from the Hardware Manager I did notice that I don't have the Ports and...
0
8677
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8335
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2605
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
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.