473,883 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RMI binding to SAME port but DIFFERENT IP address on SAME host

If I have a machine with 3 virtual IP addresses (192.168.1.[5-7]), how
can I start 3 instances of the same RMI application (each started with
different properties/configs), each listening on the port 1234, but each
instance binds to a different ip address.

that is to say:
instance #1 binds to 192.168.1.5/port 1234
instance #2 binds to 192.168.1.6/port 1234
instance #3 binds to 192.168.1.7/port 1234

I guess I am looking for something like:
Registry registry = LocateRegistry. createRegistry( <IPADDR>,<PORT> );

I tried
System.setPrope rty("java.rmi.s erver.hostname" ,"<IPADDR>") ;
but had no luck
current code looks something like this:

/******* server side *********/
System.getPrope rties().setProp erty("java.rmi. server.hostname ",serverip) ;
Registry registry = LocateRegistry. createRegistry( serverport);
registry.rebind ("RMITest", this);

//serverip is the IP to bind to... server port is port 1234

/******* client side **********/
Registry registry=Locate Registry.getReg istry(serverip, serverport);
RMITestInterfac e rmit=(RMITestIn terface)(regist ry.lookup("RMIT est"));
rmit.dosomethin gcool();
second instance (even though serverip is different) complains
java.rmi.server .ExportExceptio n: Port already in use:1234; nested
exception is: java.net.BindEx ception: Address already in use

These have to be seperate instances of the application for each
customer... I know that it is possible to run them on different ports,
but this is really not acceptable in a large clustered environment. this
would become a complete nightmare very quickly.
what am I missing?!?! I have googled high and low, and looked through
all my java books, but see no mention of such a scenario! anyone?

TIA!

-alex
Jul 17 '05
21 15747
Sam
Esmond Pitt <es*********@no t.bigpond.com> wrote in message news:<6m******* ************@ne ws-server.bigpond. net.au>...
Sam

OK, if UDP or TCP or ICMP or whatever transport layer matches the socket
to the inbound IP packet, instead of IP, the local IP address *still*
doesn't get 'thrown away as the data goes up the protocol stack',
because it must still be there in the IP packet for TCP or UDP to do
this matching, and it must also available be in the socket descriptor to
be matched. Can we agree on that?
Now, that I can agree with. In fact, the "table" which matches ip and
port number to the socket turns out to be a linked series of data
blocks, each of which must contain at least a local port, but could
contain local ip, foriegn ip and foriegn port as well. These
eventuaully link back to the actual process via series of pointers,
according to Stevens' description of Berkely 4.x distributions.
This also means that TCP, UDP, ICMP &co indeed deal with IP data, &
just goes to show that TCP/IP implementation layering is not as clean as
you might like to think. Certainly IP doesn't have to deal with TCP
data, but the other way round does happen (no worse than a derived class
using methods from its base class really). Of course Stevens vol II only describes one implementation. I don't know
that a 'cleaner' implementation where IP despatches packets to sockets
is infeasible either


What I learned was the traditional 5-layer model - App / Transport
(TCP,UDP)/ Ip / Link / Physical, is clarifed nicely in some key areas
by Steven's description of how the implementation itself is layered,
i.e:

Process / Socket Layer / Protocol Layer (TCP, UDP, IP, ICMP, IGMP) /
Interface layer.

So, here it becomes apparent that the "protocol layer" incorporates
both TCP and IP Data, assigning it to to the correct socket in the
end. This melds the transport and ip layer together in the
implementation stack, and there is clearly data overlap between the
two, specifically IP address. Nonetheless, the IP input and UDP and
TCP input routines and funtionality are clearly distinct.

Ca suffit,
Sam90
Jul 17 '05 #21
"Esmond Pitt <es*********@no tatall.bigpond. com>" wrote in comp.lang.java:

[sNip]
I'm not sure if that is what you meant to imply, but there is no
"protocol number" field in a TCP/IP header.

see http://mindprod.com/jgloss/tcpip.html

The host computer simply knows which protocol it is hosting on each
port.

You can't have two different protocols hosted on the same port, e.g.
HTTP and FTP.
[sNip] There is a protocol number field in an IP packet header, and I was
talking about IP at the time. Obviously in the case of TCP the protocol
number is the TCP protocol number, 6. BTW the statement that 'the host
computer simply knows which protocol it is hosting on each port' needs
further work. At the TCP level the host neither knows nor cares about
the protocol; at the IP level you *can* have several protocols on the
same port, e.g. ICMP, UDP, TCP.


An official list of all the protocols can be found here:

PROTOCOL NUMBERS
http://www.iana.org/assignments/protocol-numbers

Of those protocols, TCP and UDP tend to be the most interesting to
most people (probably with ICMP coming in at third place) since they are so
commonly used. Here's a list of all the port numbers used for TCP and UDP:

PORT NUMBERS
http://www.iana.org/assignments/port-numbers

Unfortunately it gets very confusing to describe these things because
the terminology is re-used. It might be easier to ask about an "IP
protocol" (e.g., TCP, UDP, ICMP, etc.), or a "TCP/IP protocol" (e.g., HTTP,
SMTP, POP3, FTP, etc.) or "UDP/IP protocol" (e.g., DNS) instead.

It's important to note that many of the protocols that are transacted
over TCP/IP and UDP/IP are sometimes supported (and recommended to be
supported) on both IP protocols. For example, you'll find that it's
possible to successfully run a DNS query over TCP/IP port 53 as well as the
usual UDP/IP port 53 on many DNS servers around the internet.

I hope this information will help to clear up some of the confusion.
Jul 17 '05 #22

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

Similar topics

2
3733
by: Aleksander Wodynski | last post by:
I have server, daemon and client (daemon and client on the same machine). When client starts it send query to the server, server send query to the deamon (daemon check if the client exist), daemon send a response to the server, server send a response to the client. First I had following numbers of udp ports: S_PORT 2613 /* Server Port number */ S1_PORT 2614 /* Server Port for Daemon response */ C_PORT 2620 /*...
9
43194
by: mBird | last post by:
I wrote a service that listens for broadcast messages from my firewall (UDP snmp trap messages) and parses and puts the data in an database. I'd also like to write an app that is a simple form that can listen in when it runs (so I can see messages in a form as they occur.) So I need the ability to listen to a UDP port with two apps at the same time (the service and my app). But when I do that I get an error:...
0
1602
by: AC [MVP MCMS] | last post by:
I have a full blown VS.NET 2003 solution with a handful of library assemblies, two web projects, and a few web service projects. The entire solution is in VSS. Recently our build server went haywire and the best solution was to blow away everything on the build server related to this solution (both filebase and virtual directories hanging off the default website). I recreated the shell of our solution's web projects...
1
2638
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from Products table.
0
2352
by: Steven Bolard | last post by:
Hello, I am trying to port my .net 1.1 application to 2.0. I am using vs2005. I am trying to get my webservices to run and although i can compile them and and get wsdl and service descriptions through internet explorer when hitting the ..asmx url, i cannot generate a proxy class to use in my winforms assembly. When i try to generate a proxy, i get no error message but nor do i get a reference.vb so there is no type info. If i then try...
5
4778
by: zxo102 | last post by:
Hi, I am doing a small project using socket server and thread in python. This is first time for me to use socket and thread things. Here is my case. I have 20 socket clients. Each client send a set of sensor data per second to a socket server. The socket server will do two things: 1. write data into a file via bsddb; 2. forward the data to a GUI written in wxpython. I am thinking the code should work as follow (not sure it is feasible)...
2
2549
by: Goran Djuranovic | last post by:
Hi All, Is it possible to have mulitple TcpListeners on listening on the same IP address and different port? Something like: Dim t1 As New TcpListener("192.168.25.25", 9000) Dim t2 As New TcpListener("192.168.25.25", 9231) t1.Start() t2.Start() TIA
1
1419
by: hitechabdul | last post by:
Hi... friends I m facing a problem in Sockets. I m continuosly opening a socket to record some data, and again I am closing that port. Again I m oipening same port to play data which wasa previously recorded. Again I m opening to re record data on the same port. This process is continuosly in a thread. It is successfully working for 2 days continuosly.. after 2 days it is not opening that same port to bind. I have use setSockOpt to reuse...
2
2237
by: djsam931 | last post by:
hi, im creating a program that allows users to chat using udp sockets.. as a general description, what i did was fork a child process that sends a udp datagram via an ephemeral port while the parent listens on some specific port.. to test the program, i am using two different terminals on the same machine.. when i run the program on one terminal, i set the ip address to 127.0.0.2.. then, i run the same program in another terminal with...
0
9945
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9797
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11157
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...
0
10422
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...
1
7978
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
7136
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4622
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
2
4229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
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.